]> git.sesse.net Git - ffmpeg/commitdiff
avformat/iff: Check data_size not overflowing int64
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 27 Sep 2020 20:20:52 +0000 (22:20 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 28 Sep 2020 18:22:30 +0000 (20:22 +0200)
Fixes: Infinite loop
Fixes: 25844/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5660803318153216
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/iff.c

index 7feb121cd02a820a8e1d9100d3b95a6ba46fc83b..04fe8be4eb80cf0818cc194128b7eb20ce6d9caf 100644 (file)
@@ -449,6 +449,9 @@ static int iff_read_header(AVFormatContext *s)
         data_size = iff->is_64bit ? avio_rb64(pb) : avio_rb32(pb);
         orig_pos = avio_tell(pb);
 
+        if (data_size >= INT64_MAX)
+            return AVERROR_INVALIDDATA;
+
         switch(chunk_id) {
         case ID_VHDR:
             st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;