]> git.sesse.net Git - ffmpeg/commitdiff
avformat/bintext: Check width
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 31 Oct 2020 12:51:47 +0000 (13:51 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 11 Nov 2020 16:05:24 +0000 (17:05 +0100)
Fixes: division by 0
Fixes: 26780/clusterfuzz-testcase-minimized-ffmpeg_dem_ADF_fuzzer-5117945027756032
Fixes: 26998/clusterfuzz-testcase-minimized-ffmpeg_dem_ADF_fuzzer-5119352359354368
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/bintext.c

index 144b4172af32c9e5963c8db50432bc823c7e14cf..bc0f6bd099fd7d4929d3d4579fdaeb76d5b62135 100644 (file)
@@ -293,6 +293,8 @@ static int adf_read_header(AVFormatContext *s)
         bin->fsize = avio_size(pb) - 1 - 192 - 4096;
         st->codecpar->width = 80<<3;
         ff_sauce_read(s, &bin->fsize, &got_width, 0);
+        if (st->codecpar->width < 8)
+            return AVERROR_INVALIDDATA;
         if (!bin->width)
             calculate_height(st->codecpar, bin->fsize);
         avio_seek(pb, 1 + 192 + 4096, SEEK_SET);