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

avcodec/agm: YUV420 without DCT needs even dimensions

Fixes: out of array access
Fixes: 19892/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5707525924323328

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 2020-01-10 21:30:38 +01:00
parent da399e2135
commit a98eeb0c1e

View File

@ -1242,6 +1242,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->dct = avctx->codec_tag != MKTAG('A', 'G', 'M', '4') && s->dct = avctx->codec_tag != MKTAG('A', 'G', 'M', '4') &&
avctx->codec_tag != MKTAG('A', 'G', 'M', '5'); avctx->codec_tag != MKTAG('A', 'G', 'M', '5');
if (!s->rgb && !s->dct) {
if ((avctx->width & 1) || (avctx->height & 1))
return AVERROR_INVALIDDATA;
}
avctx->idct_algo = FF_IDCT_SIMPLE; avctx->idct_algo = FF_IDCT_SIMPLE;
ff_idctdsp_init(&s->idsp, avctx); ff_idctdsp_init(&s->idsp, avctx);
ff_init_scantable(s->idsp.idct_permutation, &s->scantable, ff_zigzag_direct); ff_init_scantable(s->idsp.idct_permutation, &s->scantable, ff_zigzag_direct);