diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/org/brotli/wrapper/dec/Decoder.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/java/org/brotli/wrapper/dec/Decoder.java b/java/org/brotli/wrapper/dec/Decoder.java index 71b77e0..018317d 100644 --- a/java/org/brotli/wrapper/dec/Decoder.java +++ b/java/org/brotli/wrapper/dec/Decoder.java @@ -156,6 +156,15 @@ public class Decoder { totalOutputSize += chunk.length; break; + case NEEDS_MORE_INPUT: + // Give decoder a chance to process the remaining of the buffered byte. + decoder.push(0); + // If decoder still needs input, this means that stream is truncated. + if (decoder.getStatus() == DecoderJNI.Status.NEEDS_MORE_INPUT) { + throw new IOException("corrupted input"); + } + break; + default: throw new IOException("corrupted input"); } |