diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index cc2795e5c5..dd349a4a50 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -973,6 +973,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;