aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-01-14 18:41:41 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-17 21:34:53 +0200
commitbafb1c236d9711e87d43e84edb60752a627ef165 (patch)
treef94d63342508e89845c8c0fb171280ef72fff29a
parentce63dc7d2e6d355f9c554c023ae55b989e875b6c (diff)
downloadffmpeg-bafb1c236d9711e87d43e84edb60752a627ef165.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 cc7f4948c9..e10e3091ed 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);