aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-06-25 19:22:01 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-02 19:55:10 +0200
commit6674fb44f109ce022f5afa7092e156a95502194d (patch)
tree22ec2d2d941ae0aeea6e133d31632568e7095a1d
parent21ce988f98f2399b8919a8a425d467da682a29a7 (diff)
downloadffmpeg-6674fb44f109ce022f5afa7092e156a95502194d.tar.gz
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@niedermayer.cc> (cherry picked from commit 65b1ba680fb67902a9c876a49d0146eaae5a1c3d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/pngdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 9d2c74d758..1196e1a010 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -970,6 +970,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;