This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 0c0dd61b8f0cee6ed53f735d06b73998e13b6fea Author: Steven Liu <[email protected]> AuthorDate: Tue Jun 16 22:05:31 2026 +0800 Commit: stevenliu <[email protected]> CommitDate: Tue Jul 7 18:31:35 2026 +0000 avformat/dashdec: fix integer truncation in calc_max_seg_no() When computing the segment count for a SegmentTimeline entry with repeat="-1" (indefinite repeat, typical for live streams), the expression: length_of_each_segment = pls->timelines[i]->duration / pls->fragment_timescale; num = c->period_duration / length_of_each_segment; performs two successive integer divisions. The first division truncates toward zero; if the segment duration in timescale ticks is smaller than the timescale (duration < fragment_timescale), length_of_each_segment becomes 0, and the second division triggers a division by zero. Fix this by using av_rescale(), which computes period_duration * fragment_timescale / duration with 64-bit intermediate precision, avoiding both the truncation and the zero-division risk. If duration is 0 (invalid manifest), explicitly fall back to first_seq_no instead of crashing. Signed-off-by: Steven Liu <[email protected]> --- libavformat/dashdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 8aa99d7996..45897eba33 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1503,8 +1503,7 @@ static int64_t calc_max_seg_no(struct representation *pls, DASHContext *c) num = pls->first_seq_no + pls->n_timelines - 1; for (i = 0; i < pls->n_timelines; i++) { if (pls->timelines[i]->repeat == -1) { - int length_of_each_segment = pls->timelines[i]->duration / pls->fragment_timescale; - num = c->period_duration / length_of_each_segment; + num = pls->timelines[i]->duration ? av_rescale(c->period_duration, pls->fragment_timescale, pls->timelines[i]->duration) : pls->first_seq_no; } else { num += pls->timelines[i]->repeat; } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
