Commit e7af6417 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/iff: Check input space before loop in decode_delta_d()

Fixes: Timeout (114sec ->108ms)
Fixes: 19290/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5740598116220928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 934cc1fa
...@@ -1354,6 +1354,9 @@ static void decode_delta_d(uint8_t *dst, ...@@ -1354,6 +1354,9 @@ static void decode_delta_d(uint8_t *dst,
bytestream2_init(&gb, buf + ofssrc, buf_end - (buf + ofssrc)); bytestream2_init(&gb, buf + ofssrc, buf_end - (buf + ofssrc));
entries = bytestream2_get_be32(&gb); entries = bytestream2_get_be32(&gb);
if (entries * 8LL > bytestream2_get_bytes_left(&gb))
return;
while (entries && bytestream2_get_bytes_left(&gb) >= 8) { while (entries && bytestream2_get_bytes_left(&gb) >= 8) {
int32_t opcode = bytestream2_get_be32(&gb); int32_t opcode = bytestream2_get_be32(&gb);
unsigned offset = bytestream2_get_be32(&gb); unsigned offset = bytestream2_get_be32(&gb);
......
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