last byte in request range inclusive (!!)

This commit is contained in:
Sebastian Stenzel
2015-10-03 14:07:41 +02:00
parent 09b4130c3e
commit c1f32105d8
2 changed files with 2 additions and 2 deletions
@@ -53,7 +53,7 @@ class EncryptedFilePart extends EncryptedFile {
assert Files.isRegularFile(filePath);
assert contentLength != null;
final Long rangeLength = range.getRight() - range.getLeft();
final Long rangeLength = range.getRight() - range.getLeft() + 1;
outputContext.setModificationTime(Files.getLastModifiedTime(filePath).toMillis());
if (rangeLength <= 0 || range.getLeft() > contentLength - 1) {
// unsatisfiable content range:
@@ -549,7 +549,7 @@ public class Aes256Cryptor implements Cryptor, AesCryptographicConfiguration {
final Long fileSize = sensitiveHeaderContentBuf.getLong();
sensitiveHeaderContentBuf.get(fileKeyBytes);
assert pos + length < fileSize;
assert pos + length - 1 < fileSize;
// find first relevant block:
final long startBlock = pos / CONTENT_MAC_BLOCK; // floor