1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avformat/dashdec: check fragment_timescale before division in refresh_manifest

fix issue: issues/23057 POC4

In refresh_manifest(), when timelines are present, fragment_timescale is
used as the denominator to compute currentTime. If fragment_timescale is
zero (e.g., timescale attribute missing from a crafted manifest with
SegmentTimeline), this results in a division by zero.

Add fragment_timescale > 0 guard to both the video and audio timeline
processing paths to prevent the crash.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
(cherry picked from commit 6a351a3113)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Steven Liu
2026-07-06 08:04:20 +08:00
committed by Michael Niedermayer
parent 5a21a006cb
commit 400fe9454f

View File

@@ -1568,7 +1568,7 @@ static int refresh_manifest(AVFormatContext *s)
for (i = 0; i < n_videos; i++) {
struct representation *cur_video = videos[i];
struct representation *ccur_video = c->videos[i];
if (cur_video->timelines) {
if (cur_video->timelines && cur_video->fragment_timescale > 0) {
// calc current time
int64_t currentTime = get_segment_start_time_based_on_timeline(cur_video, cur_video->cur_seq_no) / cur_video->fragment_timescale;
// update segments
@@ -1584,7 +1584,7 @@ static int refresh_manifest(AVFormatContext *s)
for (i = 0; i < n_audios; i++) {
struct representation *cur_audio = audios[i];
struct representation *ccur_audio = c->audios[i];
if (cur_audio->timelines) {
if (cur_audio->timelines && cur_audio->fragment_timescale > 0) {
// calc current time
int64_t currentTime = get_segment_start_time_based_on_timeline(cur_audio, cur_audio->cur_seq_no) / cur_audio->fragment_timescale;
// update segments