Reject range starting above resource length

Closes: gh-23576
This commit is contained in:
Rossen Stoyanchev
2019-09-04 18:05:39 +01:00
parent 70bbe71235
commit bc81fa520e
2 changed files with 11 additions and 4 deletions

View File

@@ -65,6 +65,7 @@ public abstract class HttpRange {
long contentLength = getLengthFor(resource);
long start = getRangeStart(contentLength);
long end = getRangeEnd(contentLength);
Assert.isTrue(start < contentLength, "'position' exceeds the resource length " + contentLength);
return new ResourceRegion(resource, start, end - start + 1);
}