]> git.sesse.net Git - ffmpeg/commitdiff
vcodec/agm: Alloc based on coded dimensions
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 14 Nov 2019 14:10:28 +0000 (15:10 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 15 Nov 2019 20:31:43 +0000 (21:31 +0100)
Fixes: out of array read
Fixes: 18715/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5659333417500672
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>
libavcodec/agm.c

index 3b2c21e9a78c2734aa96c950decec8d427c8d58c..89f85f03c6a2d0811b3f62e6cc1481ec6023ac10 100644 (file)
@@ -827,7 +827,7 @@ static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame
 static int decode_motion_vectors(AVCodecContext *avctx, GetBitContext *gb)
 {
     AGMContext *s = avctx->priv_data;
-    int nb_mvs = ((avctx->height + 15) >> 4) * ((avctx->width + 15) >> 4);
+    int nb_mvs = ((avctx->coded_height + 15) >> 4) * ((avctx->coded_width + 15) >> 4);
     int ret, skip = 0, value, map;
 
     av_fast_padded_malloc(&s->mvectors, &s->mvectors_size,