]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/pngdec: Check for fctl after idat
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 25 Jun 2020 17:22:01 +0000 (19:22 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 1 Jul 2020 09:41:35 +0000 (11:41 +0200)
Fixes: out of array access
Fixes: 23554/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-4796622520451072.fuzz
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/pngdec.c

index ff3882a58db04ac2476913380787694786b91b32..647e7f0a74c34aa60c9167c6559e8e1d67e72042 100644 (file)
@@ -984,6 +984,11 @@ static int decode_fctl_chunk(AVCodecContext *avctx, PNGDecContext *s,
         return AVERROR_INVALIDDATA;
     }
 
+    if (s->pic_state & PNG_IDAT) {
+        av_log(avctx, AV_LOG_ERROR, "fctl after IDAT\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     s->last_w = s->cur_w;
     s->last_h = s->cur_h;
     s->last_x_offset = s->x_offset;