aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-29 21:57:12 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-20 04:43:40 +0200
commit873b08f4111af41d2456662db86075a450d3ca81 (patch)
treea5037122d70908b847dd09ff7e949ef614e80fe3
parent63ef4014c5ff13953025af861976f79c85cf373f (diff)
downloadffmpeg-873b08f4111af41d2456662db86075a450d3ca81.tar.gz
avcodec/pngdec: Require a IHDR chunk before fctl
This is required by the APNG spec Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit a1736926e9ae51706b537776722e816a4d1f6b36) Conflicts: libavcodec/pngdec.c
-rw-r--r--libavcodec/pngdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 5a2c9c2960..4a541d49a2 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -814,6 +814,11 @@ static int decode_fctl_chunk(AVCodecContext *avctx, PNGDecContext *s,
if (length != 26)
return AVERROR_INVALIDDATA;
+ if (!(s->state & PNG_IHDR)) {
+ av_log(avctx, AV_LOG_ERROR, "fctl before IHDR\n");
+ return AVERROR_INVALIDDATA;
+ }
+
sequence_number = bytestream2_get_be32(&s->gb);
s->cur_w = bytestream2_get_be32(&s->gb);
s->cur_h = bytestream2_get_be32(&s->gb);