Throw an exception if the inputstream couldn't deliver all the needed bytes

This commit is contained in:
Maschell 2019-04-30 12:04:09 +02:00
parent 3296b1befe
commit e461e78313

View File

@ -189,6 +189,9 @@ public class NUSDecryption extends AESDecryption {
} finally { } finally {
StreamUtils.closeAll(inputStream, outputStream); StreamUtils.closeAll(inputStream, outputStream);
} }
if(written < filesize) {
throw new IOException("Failed to read. Missing " + (filesize - written));
}
} }
public void decryptFileStreamHashed(InputStream inputStream, OutputStream outputStream, long fileoffset, long filesize, short contentIndex, byte[] h3Hash) public void decryptFileStreamHashed(InputStream inputStream, OutputStream outputStream, long fileoffset, long filesize, short contentIndex, byte[] h3Hash)