Tolerate oversized ranges in getBlob

This commit is contained in:
Andrew Gaul 2012-05-14 15:15:54 -07:00 committed by Andrew Gaul
parent c223f73762
commit f55231d607
2 changed files with 8 additions and 2 deletions

View File

@ -560,9 +560,12 @@ public class FilesystemAsyncBlobStore extends BaseAsyncBlobStore {
return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
}
if (offset > last || last + 1 > data.length) {
if (offset > last) {
return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
}
if (last + 1 > data.length) {
last = data.length - 1;
}
out.write(data, offset, last - offset + 1);
}
ContentMetadata cmd = blob.getPayload().getContentMetadata();

View File

@ -606,9 +606,12 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore {
return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
}
if (offset > last || last + 1 > data.length) {
if (offset > last) {
return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
}
if (last + 1 > data.length) {
last = data.length - 1;
}
out.write(data, offset, last - offset + 1);
}
ContentMetadata cmd = blob.getPayload().getContentMetadata();