aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-31 13:51:47 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-17 21:34:53 +0200
commitd5c4d054822601e6bb57b12bfe69686d042dc792 (patch)
treedf5341750f73bc0673611dc5b200e4354dd2075d
parent57d6ff94f00cb0359098cacc138c9fb04a1d8af2 (diff)
downloadffmpeg-d5c4d054822601e6bb57b12bfe69686d042dc792.tar.gz
avformat/bintext: Check width in idf_read_header()
Fixes: division by 0 Fixes: 26802/clusterfuzz-testcase-minimized-ffmpeg_dem_IDF_fuzzer-5180591554953216.fuzz 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 442d53f409c8d84c7db120227caac00af54aa884) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/bintext.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/bintext.c b/libavformat/bintext.c
index e339fef35f..58ff33533b 100644
--- a/libavformat/bintext.c
+++ b/libavformat/bintext.c
@@ -295,6 +295,8 @@ static int idf_read_header(AVFormatContext *s)
bin->fsize = avio_size(pb) - 12 - 4096 - 48;
ff_sauce_read(s, &bin->fsize, &got_width, 0);
+ if (st->codec->width < 8)
+ return AVERROR_INVALIDDATA;
if (!bin->width)
calculate_height(st->codec, bin->fsize);
avio_seek(pb, 12, SEEK_SET);