diff mbox series

[FFmpeg-devel,2/6] avformat/vividas: Check number of audio channels

Message ID 20201227174938.27369-2-michael@niedermayer.cc
State Accepted
Commit 66deab3a2609aa9462709c82be5d4efbb6af2a08
Headers show
Series [FFmpeg-devel,1/6] avformat/mxfdec: Do not clear arrays in mxf_read_index_entry_array()
Related show

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 Dec. 27, 2020, 5:49 p.m. UTC
Fixes: division by 0
Fixes: 28597/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5752201490333696

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

Comments

Michael Niedermayer Jan. 5, 2021, 12:27 a.m. UTC | #1
On Sun, Dec 27, 2020 at 06:49:34PM +0100, Michael Niedermayer wrote:
> Fixes: division by 0
> Fixes: 28597/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5752201490333696
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/vividas.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index 96e0631b06..d745770dc4 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -373,7 +373,7 @@  static int track_header(VividasDemuxContext *viv, AVFormatContext *s,  uint8_t *
         avio_rl16(pb); //codec_subid
         st->codecpar->channels = avio_rl16(pb); // channels
         st->codecpar->sample_rate = avio_rl32(pb); // sample_rate
-        if (st->codecpar->sample_rate <= 0)
+        if (st->codecpar->sample_rate <= 0 || st->codecpar->channels <= 0)
             return AVERROR_INVALIDDATA;
         avio_seek(pb, 10, SEEK_CUR); // data_1
         q = avio_r8(pb);