1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avcodec/wavpack: Fix overflow in p=31

Untested with "non fuzzed" samples as i have no such file
The reference 5.6.0 decoder appears to also have undefined behavior in the lossless codepath for this

Fixes: shift exponent 32 is too large for 32-bit type 'int'
Fixes: 50930/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-6319201949712384

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2022-09-11 12:00:31 +02:00
parent ee650398ec
commit 9bfae83856
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -126,7 +126,7 @@ static av_always_inline unsigned get_tail(GetBitContext *gb, unsigned k)
if (k < 1)
return 0;
p = av_log2(k);
e = (1 << (p + 1)) - k - 1;
e = (1LL << (p + 1)) - k - 1;
res = get_bits_long(gb, p);
if (res >= e)
res = (res << 1) - e + get_bits1(gb);