From d067ab3ccdeaa340e8c045a0fd5bcfc22b809e8f Mon Sep 17 00:00:00 2001 From: Aurelien David Date: Mon, 13 Feb 2023 15:41:48 +0100 Subject: [PATCH] mpeg2ts: add section size check (#2395) --- src/media_tools/mpegts.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/media_tools/mpegts.c b/src/media_tools/mpegts.c index 30fb2bb3fe..7deabb6304 100644 --- a/src/media_tools/mpegts.c +++ b/src/media_tools/mpegts.c @@ -946,6 +946,11 @@ static void gf_m2ts_process_tdt_tot(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *tdt return; } + if (data_size < 5) { + GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[MPEG-2 TS] Section data size too small to read date (len: %u)\n", data_size)); + return; + } + /*UTC_time - see annex C of DVB-SI ETSI EN 300468*/ /* decodes an Modified Julian Date (MJD) into a Co-ordinated Universal Time (UTC) See annex C of DVB-SI ETSI EN 300468 */