[FFmpeg-cvslog] avformat/siff: Basic pkt_size check
Michael Niedermayer
git at videolan.org
Sun Jan 5 01:29:01 EET 2025
ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Thu Jul 11 20:58:21 2024 +0200| [2975e218a0b4915d453c3331c77b90be4c806ab0] | committer: Michael Niedermayer
avformat/siff: Basic pkt_size check
Fixes: half of CID1258461 Overflowed constant
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 124a97dd8b7636fb52e042b2e85a44cce40ab5e7)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2975e218a0b4915d453c3331c77b90be4c806ab0
---
libavformat/siff.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavformat/siff.c b/libavformat/siff.c
index 40eed8d700..cc6b6c4484 100644
--- a/libavformat/siff.c
+++ b/libavformat/siff.c
@@ -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;
More information about the ffmpeg-cvslog
mailing list