avcodec/dsddec: Check channels

Fixes: division by zero
Fixes: 21677/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSD_MSBF_fuzzer-5712547983654912
Fixes: 21751/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSD_LSBF_fuzzer-5197097180856320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2570a8777e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-05-04 00:04:49 +02:00
parent 9fd634161f
commit b35b3dfc25

View File

@ -93,6 +93,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
DSDContext * s;
int i;
if (!avctx->channels)
return AVERROR_INVALIDDATA;
init_static_data();
s = av_malloc_array(sizeof(DSDContext), avctx->channels);