aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-01-12 21:17:18 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:20 +0200
commit65dd97ac32d9fe608dafa0ce735ad37a5f52e09d (patch)
treefc080904174d794588381889fa31359c8dd6fee0
parentac301bcf8ea0e4d13dbbd7c345686763a732a9c0 (diff)
downloadffmpeg-65dd97ac32d9fe608dafa0ce735ad37a5f52e09d.tar.gz
avformat/asfdec_o: Check size vs. offset in detect_unknown_subobject()
Fixes: signed integer overflow: 2314885530818453566 + 7503032301549264928 cannot be represented in type 'long' Fixes: 26639/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_O_fuzzer-6024222100684800 Alternatively this could be ignored but then the end condition of the loop would be hard to reach as avio_tell() is int64_t Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 0bee216ad454dd7238a03dd9a76428cc6c3233cc) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/asfdec_o.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c
index 3f43fd1b47..2af14afab9 100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@ -1676,6 +1676,9 @@ static int detect_unknown_subobject(AVFormatContext *s, int64_t offset, int64_t
ff_asf_guid guid;
int ret;
+ if (offset > INT64_MAX - size)
+ return AVERROR_INVALIDDATA;
+
while (avio_tell(pb) <= offset + size) {
if (avio_tell(pb) == asf->offset)
break;