Commit f27a5102 authored by Michael Niedermayer's avatar 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/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 65b1ba680fb67902a9c876a49d0146eaae5a1c3d)
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent a3fdeb0c
...@@ -984,6 +984,11 @@ static int decode_fctl_chunk(AVCodecContext *avctx, PNGDecContext *s, ...@@ -984,6 +984,11 @@ static int decode_fctl_chunk(AVCodecContext *avctx, PNGDecContext *s,
return AVERROR_INVALIDDATA; 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_w = s->cur_w;
s->last_h = s->cur_h; s->last_h = s->cur_h;
s->last_x_offset = s->x_offset; s->last_x_offset = s->x_offset;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment