1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/siff: Basic pkt_size check

Fixes: half of CID1258461 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 124a97dd8b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-07-11 20:58:21 +02:00
parent 5d62f99b08
commit 479f3e3536
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -198,7 +198,10 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
if (c->cur_frame >= c->frames)
return AVERROR_EOF;
if (c->curstrm == -1) {
c->pktsize = avio_rl32(s->pb) - 4;
unsigned pktsize = avio_rl32(s->pb);
if (pktsize < 4)
return AVERROR_INVALIDDATA;
c->pktsize = pktsize - 4;
c->flags = avio_rl16(s->pb);
if (c->flags & VB_HAS_AUDIO && !c->has_audio)
return AVERROR_INVALIDDATA;