diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-02-15 22:56:18 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-03 12:10:23 +0200 |
commit | 6a300f6a9079d2c3156d8c1f03f50fdad0cee0af (patch) | |
tree | c8608a1f1a9d667e2ad3114577a53190b27553a7 | |
parent | 555d2ab5a5685b369b27609cbafe6ea5bf5c8ed3 (diff) | |
download | ffmpeg-6a300f6a9079d2c3156d8c1f03f50fdad0cee0af.tar.gz |
fftools/ffmpeg: Fix integer overflow in duration computation in seek_to_start()
Fixes: signed integer overflow: -9223372036854775808 - 9223372036854775807 cannot be represented in type 'long'
Fixes: Ticket8142
Found-by: Suhwan
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4f4ad33d96a01d82edf56d58599017cb0ae5bfa8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | fftools/ffmpeg.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index c743a2a6fa..24307c3cae 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -4242,7 +4242,8 @@ static int seek_to_start(InputFile *ifile, AVFormatContext *is) ifile->time_base = ist->st->time_base; /* the total duration of the stream, max_pts - min_pts is * the duration of the stream without the last frame */ - duration += ist->max_pts - ist->min_pts; + if (ist->max_pts > ist->min_pts && ist->max_pts - (uint64_t)ist->min_pts < INT64_MAX - duration) + duration += ist->max_pts - ist->min_pts; ifile->time_base = duration_max(duration, &ifile->duration, ist->st->time_base, ifile->time_base); } |