avcodec/wavpack: Fix runtime error: shift exponent 32 is too large for 32-bit type...
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 1 Jun 2017 16:48:37 +0000 (18:48 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 1 Jun 2017 20:20:16 +0000 (22:20 +0200)
Fixes: 1967/clusterfuzz-testcase-minimized-5757031199801344

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/wavpack.c

index b216eb0..25c8e94 100644 (file)
@@ -188,7 +188,7 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb,
                     goto error;
                 t += t2;
             } else {
-                if (get_bits_left(gb) < t2 - 1)
+                if (t2 >= 32 || get_bits_left(gb) < t2 - 1)
                     goto error;
                 t += get_bits_long(gb, t2 - 1) | (1 << (t2 - 1));
             }