summaryrefslogtreecommitdiff
path: root/libavformat/bfi.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-01-14 18:41:41 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:20 +0200
commit1e44c44cd45fbb45afc6e5e8ff3626900ed52ed7 (patch)
tree30b8cc037fe16a92dea3cfad4a96e2f6b30c2fb5 /libavformat/bfi.c
parent55658df3d1b0a314f5a64fcb4e3b1e5c846c5d62 (diff)
downloadffmpeg-1e44c44cd45fbb45afc6e5e8ff3626900ed52ed7.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>
Diffstat (limited to 'libavformat/bfi.c')
-rw-r--r--libavformat/bfi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index 568363dd91..cb628d2674 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);