Commit c1ed78a5 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/utils: avoid overflow in compute_chapters_end() with huge durations

Fixes: usan_granule_overflow
Found-by: 's avatarThomas Guilbert <tguilbert@google.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 2be3007e
......@@ -3041,7 +3041,7 @@ static void compute_chapters_end(AVFormatContext *s)
unsigned int i, j;
int64_t max_time = 0;
if (s->duration > 0)
if (s->duration > 0 && s->start_time < INT64_MAX - s->duration)
max_time = s->duration +
((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment