From 630b5084ee255549d25d6da7ec50b7a53861d95a Mon Sep 17 00:00:00 2001 From: Eugene Kliuchnikov Date: Thu, 29 Jul 2021 22:29:43 +0200 Subject: Update (#914) * slimmer stack frames in encoder * fix MSAN problem in hasher_composite (not dangerous, only in large_window mode) * fix JNI decoder wrapper - power-of-two payloads fail to decode sometimes * reformat polyfil.js and decode_test.js --- java/org/brotli/wrapper/dec/Decoder.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'java') 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"); } -- cgit v1.1