avcodec/wavpack: Fix invalid shift and integer overflow

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>
This commit is contained in:
Michael Niedermayer 2017-04-07 03:38:12 +02:00
parent d2657d225c
commit fc4f88375b

View 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 {