]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/agm: Check frame dimensions
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 10 Apr 2019 22:36:48 +0000 (00:36 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 11 Apr 2019 17:25:42 +0000 (19:25 +0200)
Fixes: out of array access
Fixes: 14110/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5649184864075776
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 ab9b93a5f8fc4536233db8900a4a915d38c77e1e..f5fd5d065e6121cca6a780401f8b6206cbe595f5 100644 (file)
@@ -1178,6 +1178,9 @@ static int decode_frame(AVCodecContext *avctx, void *data,
             av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
             return AVERROR_INVALIDDATA;
         }
+        if (s->prev_frame-> width != frame->width ||
+            s->prev_frame->height != frame->height)
+            return AVERROR_INVALIDDATA;
 
         if (!(s->flags & 2)) {
             ret = av_frame_copy(frame, s->prev_frame);