aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-01-10 21:30:38 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-05-19 17:17:35 +0200
commit6a4b26eaf66d98860b4c5fda6b56feba7faf4a56 (patch)
tree54397ef05a8c907bd42da245ce48374fa5ba749b
parente6567ca7dc0901811c1925a50db9132b577270a9 (diff)
downloadffmpeg-6a4b26eaf66d98860b4c5fda6b56feba7faf4a56.tar.gz
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> (cherry picked from commit a98eeb0c1e867238905ed095b48184f706adf328) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/agm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/agm.c b/libavcodec/agm.c
index c5c9a88dd9..bc9dfc02f3 100644
--- a/libavcodec/agm.c
+++ b/libavcodec/agm.c
@@ -1242,6 +1242,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->dct = avctx->codec_tag != MKTAG('A', 'G', 'M', '4') &&
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;
ff_idctdsp_init(&s->idsp, avctx);
ff_init_scantable(s->idsp.idct_permutation, &s->scantable, ff_zigzag_direct);