[FFmpeg-devel] [PATCH 2/5] avcodec/iff: Skip overflowing runs in decode_delta_d()

Michael Niedermayer michael at niedermayer.cc
Mon Nov 18 18:30:11 EET 2019


Fixes: Timeout (107sec - 75ms>
Fixes: 18812/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-6295585225441280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/iff.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 500f9bf367..5184ff0a4e 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -1358,6 +1358,8 @@ static void decode_delta_d(uint8_t *dst,
             bytestream2_seek_p(&pb, (offset / planepitch_byte) * pitch + (offset % planepitch_byte) + k * planepitch, SEEK_SET);
             if (opcode >= 0) {
                 uint32_t x = bytestream2_get_be32(&gb);
+                if (opcode && 4 + (opcode - 1LL) * pitch > bytestream2_get_bytes_left_p(&pb))
+                    continue;
                 while (opcode && bytestream2_get_bytes_left_p(&pb) > 0) {
                     bytestream2_put_be32(&pb, x);
                     bytestream2_skip_p(&pb, pitch - 4);
-- 
2.23.0



More information about the ffmpeg-devel mailing list