1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/apm: Check channels

Fixes: division by 0
Fixes: 45643/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4957777905188864.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2022-03-20 00:01:16 +01:00
parent 7ec28e1d4c
commit 8173a6c130

View File

@ -140,7 +140,7 @@ static int apm_read_header(AVFormatContext *s)
if (par->bits_per_coded_sample != 4)
return AVERROR_INVALIDDATA;
if (channels > 2)
if (channels > 2 || channels == 0)
return AVERROR_INVALIDDATA;
av_channel_layout_default(&par->ch_layout, channels);