diff mbox series

[FFmpeg-devel,1/4] avformat/genh: Check block_align

Message ID 20201019155955.27725-1-michael@niedermayer.cc
State Accepted
Commit 37396e9ba85d8969a3b5e3314ab99ff604845628
Headers show
Series [FFmpeg-devel,1/4] avformat/genh: Check block_align
Related show

Checks

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

Commit Message

Michael Niedermayer Oct. 19, 2020, 3:59 p.m. UTC
Fixes: infinite loop
Fixes: 26440/clusterfuzz-testcase-minimized-ffmpeg_dem_GENH_fuzzer-5632134020333568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/genh.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Niedermayer Oct. 24, 2020, 5:10 p.m. UTC | #1
On Mon, Oct 19, 2020 at 05:59:52PM +0200, Michael Niedermayer wrote:
> Fixes: infinite loop
> Fixes: 26440/clusterfuzz-testcase-minimized-ffmpeg_dem_GENH_fuzzer-5632134020333568
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/genh.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/genh.c b/libavformat/genh.c
index 61adf49964..544d063aa4 100644
--- a/libavformat/genh.c
+++ b/libavformat/genh.c
@@ -144,6 +144,9 @@  static int genh_read_header(AVFormatContext *s)
         }
     }
 
+    if (st->codecpar->block_align <= 0)
+        return AVERROR_INVALIDDATA;
+
     avio_skip(s->pb, start_offset - avio_tell(s->pb));
 
     avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);