mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-16 04:32:47 +02:00
avformat/hls: Check TIME-OFFSET value
Fixes: UB with out of range values
Fixes: poc_overflow.m3u8
Found-by: jiale yao
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 59094859a8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
+8
-3
@@ -963,9 +963,14 @@ static int parse_playlist(HLSContext *c, const char *url,
|
||||
goto fail;
|
||||
}
|
||||
if (av_strstart(ptr, "TIME-OFFSET=", &time_offset_value)) {
|
||||
float offset = strtof(time_offset_value, NULL);
|
||||
pls->start_time_offset = offset * AV_TIME_BASE;
|
||||
pls->time_offset_flag = 1;
|
||||
double offset = strtod(time_offset_value, NULL) * AV_TIME_BASE;
|
||||
if (offset >= -0x1p63 && offset < 0x1p63) {
|
||||
pls->start_time_offset = offset;
|
||||
pls->time_offset_flag = 1;
|
||||
} else {
|
||||
av_log(c->ctx, AV_LOG_WARNING, "TIME-OFFSET value is"
|
||||
"invalid, it will be ignored");
|
||||
}
|
||||
} else {
|
||||
av_log(c->ctx, AV_LOG_WARNING, "#EXT-X-START value is"
|
||||
"invalid, it will be ignored");
|
||||
|
||||
Reference in New Issue
Block a user