]> git.sesse.net Git - ffmpeg/commitdiff
avformat/bfi: Check chunk_header
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 14 Jan 2021 17:41:41 +0000 (18:41 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 23 Jan 2021 13:32:54 +0000 (14:32 +0100)
Fixes: signed integer overflow: -2147483648 - 3 cannot be represented in type 'int'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_BFI_fuzzer-6665764123836416
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/bfi.c

index 29e2cf8cf4193d9151768b727dabdd108106d367..2dab986f3af75ecf4bc0ca4aab6cb492e616723c 100644 (file)
@@ -69,6 +69,9 @@ static int bfi_read_header(AVFormatContext * s)
     /* Set the total number of frames. */
     avio_skip(pb, 8);
     chunk_header           = avio_rl32(pb);
+    if (chunk_header < 3)
+        return AVERROR_INVALIDDATA;
+
     bfi->nframes           = avio_rl32(pb);
     avio_rl32(pb);
     avio_rl32(pb);