[FFmpeg-devel] [PATCH 2/8] tools/target_dem_fuzzer: Consider it an EIO when reading position wraps around 64bit

Michael Niedermayer michael at niedermayer.cc
Fri Oct 23 21:39:34 EEST 2020


Fixes: signed integer overflow: 9223372036854775807 + 564 cannot be represented in type 'long'
Fixes: 26494/clusterfuzz-testcase-minimized-ffmpeg_dem_VOC_fuzzer-576754158849228

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

diff --git a/tools/target_dem_fuzzer.c b/tools/target_dem_fuzzer.c
index 8c9e373367..4add459aef 100644
--- a/tools/target_dem_fuzzer.c
+++ b/tools/target_dem_fuzzer.c
@@ -49,6 +49,8 @@ static int io_read(void *opaque, uint8_t *buf, int buf_size)
         c->filesize = FFMIN(c->pos, c->filesize);
         return AVERROR_EOF;
     }
+    if (c->pos > INT64_MAX - size)
+        return AVERROR(EIO);
 
     memcpy(buf, c->fuzz, size);
     c->fuzz      += size;
-- 
2.17.1



More information about the ffmpeg-devel mailing list