aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-01-14 18:41:41 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:53:29 +0200
commit268f25c7744c7a0cc79d6baf18ff6af600826fad (patch)
tree3c2f399fb2b33150a97cc34f740e9d0e8818a6de
parentd72a06402c2de9bb8b319f460258efaee8300425 (diff)
downloadffmpeg-268f25c7744c7a0cc79d6baf18ff6af600826fad.tar.gz
avformat/bfi: Check chunk_header
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> (cherry picked from commit 638a151a877c27a46c15643db26c9ba726feecde) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/bfi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index 6c98e33ab4..9d88533acf 100644
--- a/libavformat/bfi.c
+++ b/libavformat/bfi.c
@@ -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);