avformat/mpegts: Check program_info_length

Fixes: overread
No testcase

Found-by: Marton Balint
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1fd718c6a9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2026-01-26 02:43:25 +01:00
parent d2c944970b
commit 1877b31590
+2 -1
View File
@@ -2335,7 +2335,8 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
av_log(ts->stream, AV_LOG_TRACE, "pcr_pid=0x%x\n", pcr_pid);
program_info_length = get16(&p, p_end);
if (program_info_length < 0)
if (program_info_length < 0 || (program_info_length & 0xFFF) > p_end - p)
return;
program_info_length &= 0xfff;
while (program_info_length >= 2) {