1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-10-06 05:47:18 +02:00

avformat/apngdec: allow other chunks between fcTL and fdAT/IDAT

This commit is contained in:
devjeonghwan
2025-08-07 01:37:37 +09:00
committed by Leo Izen
parent a9e7b5aa07
commit 243b392d83

View File

@@ -344,12 +344,15 @@ static int apng_read_packet(AVFormatContext *s, AVPacket *pkt)
if ((ret = decode_fctl_chunk(s, ctx, pkt)) < 0)
return ret;
/* fcTL must precede fdAT or IDAT */
/* fcTL may be followed by other chunks before fdAT or IDAT */
len = avio_rb32(pb);
tag = avio_rl32(pb);
if (len > 0x7fffffff ||
tag != MKTAG('f', 'd', 'A', 'T') &&
tag != MKTAG('I', 'D', 'A', 'T'))
if (len > 0x7fffffff)
return AVERROR_INVALIDDATA;
/* check for empty frame */
if (tag == MKTAG('f', 'c', 'T', 'L') ||
tag == MKTAG('I', 'E', 'N', 'D'))
return AVERROR_INVALIDDATA;
size = 38 /* fcTL */ + 8 /* len, tag */ + len + 4 /* crc */;