Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-02-16 00:56:18 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 14:33:44 +0300
commit759febd8804e17bd6ed2cfa1fc1f2117172693df (patch)
tree2fdf0f83a47d0dff558d7dcf86b641f2e655e68b /fftools
parent1bcbe5bc9bf030195cb2db287d00b0a4dfa6428b (diff)
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>
Diffstat (limited to 'fftools')
-rw-r--r--fftools/ffmpeg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index d436a0e71c..00c80fdcbe 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -4193,7 +4193,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);
}