[FFmpeg-cvslog] avcodec/pngdec: Check for fctl after idat

Michael Niedermayer git at videolan.org
Sun Jul 5 20:51:43 EEST 2020


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Thu Jun 25 19:22:01 2020 +0200| [8cae3778ea21388be0bcbe747826e8cd63832b7b] | committer: Michael Niedermayer

avcodec/pngdec: Check for fctl after idat

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 at niedermayer.cc>
(cherry picked from commit 65b1ba680fb67902a9c876a49d0146eaae5a1c3d)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8cae3778ea21388be0bcbe747826e8cd63832b7b
---

 libavcodec/pngdec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index bfc7c9da0b..4cace3d5af 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -925,6 +925,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;



More information about the ffmpeg-cvslog mailing list