avformat/alp: Check num_channels

Fixes: division by 0
Fixes: 45615/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-582660348405350
Fixes: 45625/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-4821437943250944
Fixes: 45839/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5857286998851584.fuzz
Fixes: 45844/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6552705772945408

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-19 23:28:53 +01:00
parent 723065a346
commit 2e069f6b69
1 changed files with 1 additions and 1 deletions

View File

@ -122,7 +122,7 @@ static int alp_read_header(AVFormatContext *s)
par->format = AV_SAMPLE_FMT_S16;
par->sample_rate = hdr->sample_rate;
if (hdr->num_channels > 2)
if (hdr->num_channels > 2 || hdr->num_channels == 0)
return AVERROR_INVALIDDATA;
av_channel_layout_default(&par->ch_layout, hdr->num_channels);