aboutsummaryrefslogtreecommitdiffstats
path: root/tools/target_dem_fuzzer.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-23 10:48:36 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-11-07 20:50:33 +0100
commit8fbcc546b83e2ce242a0b75054ec2ca304a171df (patch)
tree9e5896f11aa707f3d8192f8b121d98ebd8b74e05 /tools/target_dem_fuzzer.c
parent79cf7c71910a69b9f22b3e7ee6508a771262abaf (diff)
downloadffmpeg-8fbcc546b83e2ce242a0b75054ec2ca304a171df.tar.gz
tools/target_dem_fuzzer: Consider it an EIO when reading position wraps around 64bit
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 FIxes: 26875/clusterfuzz-testcase-minimized-ffmpeg_dem_C93_fuzzer-5996226782429184 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'tools/target_dem_fuzzer.c')
-rw-r--r--tools/target_dem_fuzzer.c2
1 files changed, 2 insertions, 0 deletions
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;