Commit 9acdf17b authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/prosumer: Check for bytestream eof in decompress()

Fixes: Infinite loop
Fixes: 10685/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PROSUMER_fuzzer-5652236881887232

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegReviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 8e50215b
...@@ -57,7 +57,7 @@ static int decompress(GetByteContext *gb, int size, PutByteContext *pb, const ui ...@@ -57,7 +57,7 @@ static int decompress(GetByteContext *gb, int size, PutByteContext *pb, const ui
b = lut[2 * idx]; b = lut[2 * idx];
while (1) { while (1) {
if (bytestream2_get_bytes_left_p(pb) <= 0) if (bytestream2_get_bytes_left_p(pb) <= 0 || bytestream2_get_eof(pb))
return 0; return 0;
if (((b & 0xFF00u) != 0x8000u) || (b & 0xFFu)) { if (((b & 0xFF00u) != 0x8000u) || (b & 0xFFu)) {
if ((b & 0xFF00u) != 0x8000u) { if ((b & 0xFF00u) != 0x8000u) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment