avcodec/wavpack: Fix runtime error: signed integer overflow: 2013265955 - -134217694...
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 31 May 2017 20:53:02 +0000 (22:53 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 31 May 2017 20:53:51 +0000 (22:53 +0200)
Fixes: 1922/clusterfuzz-testcase-minimized-5561194112876544

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 929d9ef..b216eb0 100644 (file)
@@ -245,7 +245,7 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb,
             if (get_bits_left(gb) <= 0)
                 goto error;
             if (get_bits1(gb)) {
-                add -= (mid - base);
+                add -= (mid - (unsigned)base);
                 base = mid;
             } else
                 add = mid - base - 1;