avcodec/wavpack: Fix invalid shift and integer overflow
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 7 Apr 2017 01:38:12 +0000 (03:38 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 4 May 2017 18:32:11 +0000 (20:32 +0200)
Fixes: 940/clusterfuzz-testcase-5200378381467648

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

index 2bda359..bc4402f 100644 (file)
@@ -157,7 +157,7 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb,
         } else {
             t = get_unary_0_33(gb);
             if (t >= 2) {
-                if (get_bits_left(gb) < t - 1)
+                if (t >= 32 || get_bits_left(gb) < t - 1)
                     goto error;
                 t = get_bits_long(gb, t - 1) | (1 << (t - 1));
             } else {