diff mbox series

[FFmpeg-devel,5/5] avformat/bintext: Check width in idf_read_header()

Message ID 20201102002128.6685-5-michael@niedermayer.cc
State Accepted
Commit 442d53f409c8d84c7db120227caac00af54aa884
Headers show
Series [FFmpeg-devel,1/5] avformat/vqf: Check len for COMM chunks | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer Nov. 2, 2020, 12:21 a.m. UTC
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>
---
 libavformat/bintext.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Nov. 4, 2020, 10:31 p.m. UTC | #1
On Mon, Nov 02, 2020 at 01:21:28AM +0100, Michael Niedermayer wrote:
> 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>
> ---
>  libavformat/bintext.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/bintext.c b/libavformat/bintext.c
index 810d870637..bc0f6bd099 100644
--- a/libavformat/bintext.c
+++ b/libavformat/bintext.c
@@ -346,6 +346,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->codecpar->width < 8)
+        return AVERROR_INVALIDDATA;
     if (!bin->width)
         calculate_height(st->codecpar, bin->fsize);
     avio_seek(pb, 12, SEEK_SET);