diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index ff3882a58d..647e7f0a74 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -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;