This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/8.1 in repository ffmpeg.
commit b2c3ad438c3b013d70a6557f6623d7d1fbcbeebc Author: Michael Niedermayer <[email protected]> AuthorDate: Sat Jun 6 21:02:12 2026 +0200 Commit: Michael Niedermayer <[email protected]> CommitDate: Sat Sep 19 17:00:07 2026 +0200 avformat/hlsenc: reject out-of-range EXT-X-PROGRAM-DATE-TIME Parse the timestamp with av_small_strptime() instead of sscanf(): it range-checks each field (year 0-9999, month, day, hour, minute, second) and limits the number of digits consumed, so an oversized field can no longer overflow during parsing. The mktime() result is additionally checked for EOVERFLOW. Fixes: integer overflow Found-by: Kery (Qi Kery <[email protected]>) Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit c82196b29901dd204e3f17f25ce8c147ce8f3dad) --- libavformat/hlsenc.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index e6bb749c73..3b4f0f2db5 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -37,6 +37,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/mem.h" #include "libavutil/opt.h" +#include "libavutil/parseutils.h" #include "libavutil/log.h" #include "libavutil/random_seed.h" #include "libavutil/time.h" @@ -1223,23 +1224,26 @@ static int parse_playlist(AVFormatContext *s, const char *url, VariantStream *vs } } } else if (av_strstart(line, "#EXT-X-PROGRAM-DATE-TIME:", &ptr)) { - struct tm program_date_time; - int y,M,d,h,m,s; - double ms; - if (sscanf(ptr, "%d-%d-%dT%d:%d:%d.%lf", &y, &M, &d, &h, &m, &s, &ms) != 7) { + struct tm program_date_time = { 0 }; + double ms = 0; + char *q = av_small_strptime(ptr, "%Y-%m-%dT%H:%M:%S", &program_date_time); + + if (!q) { ret = AVERROR_INVALIDDATA; goto fail; } - - program_date_time.tm_year = y - 1900; - program_date_time.tm_mon = M - 1; - program_date_time.tm_mday = d; - program_date_time.tm_hour = h; - program_date_time.tm_min = m; - program_date_time.tm_sec = s; + if (*q == '.') + ms = atof(q + 1); program_date_time.tm_isdst = -1; - discont_program_date_time = mktime(&program_date_time); + errno = 0; + time_t t = mktime(&program_date_time); + if (t == (time_t)-1 && errno == EOVERFLOW) { + ret = AVERROR_INVALIDDATA; + goto fail; + } + discont_program_date_time = t; + discont_program_date_time += (double)(ms / 1000); } else if (av_strstart(line, "#", NULL)) { continue; -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
