diff mbox series

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

Message ID 20201024222312.5806-5-michael@niedermayer.cc
State Accepted
Headers show
Series [FFmpeg-devel,1/8] tools/target_dem_fuzzer: Limit max blocks
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Michael Niedermayer Oct. 24, 2020, 10:23 p.m. UTC
Fixes: signed integer overflow: 9223372036854775807 + 564 cannot be represented in type 'long'
Fixes: 26494/clusterfuzz-testcase-minimized-ffmpeg_dem_VOC_fuzzer-576754158849228
Fixes: 26549/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-4844306424397824

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

Comments

Michael Niedermayer Nov. 7, 2020, 7:54 p.m. UTC | #1
On Sun, Oct 25, 2020 at 12:23:09AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 9223372036854775807 + 564 cannot be represented in type 'long'
> Fixes: 26494/clusterfuzz-testcase-minimized-ffmpeg_dem_VOC_fuzzer-576754158849228
> Fixes: 26549/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-4844306424397824
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  tools/target_dem_fuzzer.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/tools/target_dem_fuzzer.c b/tools/target_dem_fuzzer.c
index 6f4f062f13..e4f41765d6 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;