[FFmpeg-cvslog] avformat/mpeg: Check len in mpegps_probe()
Michael Niedermayer
git at videolan.org
Sun Jan 5 01:28:09 EET 2025
ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Fri Jun 7 00:19:01 2024 +0200| [3452b66e09145f78da6929d68e29c732c4697a1a] | committer: Michael Niedermayer
avformat/mpeg: Check len in mpegps_probe()
Fixes: CID1473590 Untrusted loop bound
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit ca237a841e9e78ac02694124d81ff78c74b0bf72)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3452b66e09145f78da6929d68e29c732c4697a1a
---
libavformat/mpeg.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 56b10a32e0..f0b1f1ac34 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -78,6 +78,9 @@ static int mpegps_probe(AVProbeData *p)
int pes = endpes <= i && check_pes(p->buf + i, p->buf + p->buf_size);
int pack = check_pack_header(p->buf + i);
+ if (len > INT_MAX - i)
+ break;
+
if (code == SYSTEM_HEADER_START_CODE)
sys++;
else if (code == PACK_START_CODE && pack)
More information about the ffmpeg-cvslog
mailing list