From e461e783132c73a03ba6571b4768ed658f7929af Mon Sep 17 00:00:00 2001 From: Maschell Date: Tue, 30 Apr 2019 12:04:09 +0200 Subject: [PATCH] Throw an exception if the inputstream couldn't deliver all the needed bytes --- src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java b/src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java index b9dc0ae..00ad9b0 100644 --- a/src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java +++ b/src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java @@ -189,6 +189,9 @@ public class NUSDecryption extends AESDecryption { } finally { 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)