[FFmpeg-devel] [PATCH] mpegts.c: pat_cb(): ensure all PIDs are valid
Scott Theisen
scott.the.elm at gmail.com
Fri Nov 15 07:38:00 EET 2024
originally from:
https://github.com/MythTV/mythtv/commit/a1d4d112c3f962a85ddd6248592421171fc8331c
referencing:
https://code.mythtv.org/trac/ticket/1887
ISO/IEC 13818-1:2021 specifies a valid range of [0x0010, 0x1FFE] in
§ 2.4.4.6 Semantic definition of fields in program association section
and Table 2-3 – PID table
---
libavformat/mpegts.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 78ab7f7efe..6d5dc3050b 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2580,6 +2580,12 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
break;
av_log(ts->stream, AV_LOG_TRACE, "sid=0x%x pid=0x%x\n", sid, pmt_pid);
+ if (pmt_pid <= 0x000F || pmt_pid >= 0x1FFF)
+ {
+ av_log(ts->stream, AV_LOG_ERROR, "Invalid PAT ignored "
+ "MPEG Program Number=0x%x pid=0x%x\n", sid, pmt_pid);
+ return;
+ }
if (sid == 0x0000) {
/* NIT info */
--
2.43.0
More information about the ffmpeg-devel
mailing list