avcodec/wmaprodec: Check that the streams channels do not exceed the overall channels

Fixes: NULL pointer dereference
Fixes: 18075/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5708262036471808
Fixes: 18087/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5740627634946048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2019-10-12 18:32:08 +02:00
parent e835a9d302
commit e418b315dd
1 changed files with 1 additions and 1 deletions

View File

@ -437,7 +437,7 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu
av_log(avctx, AV_LOG_ERROR, "invalid number of channels per XMA stream %d\n",
s->nb_channels);
return AVERROR_INVALIDDATA;
} else if (s->nb_channels > WMAPRO_MAX_CHANNELS) {
} else if (s->nb_channels > WMAPRO_MAX_CHANNELS || s->nb_channels > avctx->channels) {
avpriv_request_sample(avctx,
"More than %d channels", WMAPRO_MAX_CHANNELS);
return AVERROR_PATCHWELCOME;