1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-09 14:14:39 +02:00

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

Fixes: usan_granule_overflow

Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2016-05-28 23:51:35 +02:00
parent 2be3007ed5
commit c1ed78a591

View File

@ -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);