diff options
author | Mans Rullgard <mans@mansr.com> | 2012-12-07 13:53:56 +0000 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-03-13 14:14:54 +0100 |
commit | d8fbae3c3c63505774288abe7a98404a507b60e3 (patch) | |
tree | 17388cba70cb0017301d9f40f96e7690011ef749 /libavformat/utils.c | |
parent | f82e127dd9c7c0d54bf6400f83c7825e571f9a9e (diff) | |
download | ffmpeg-d8fbae3c3c63505774288abe7a98404a507b60e3.tar.gz |
lavf: fix arithmetic overflows in avformat_seek_file()
The values compared here can be more than INT64_MAX apart. Since the
difference is always positive, converting to uint64_t before subtracting
gives the correct result without overflows.
Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 91ac403b1316d59b4f43c4ea0f237e24cec2819a)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 9dc1dcb2c6..a92acde062 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1854,7 +1854,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int //Fallback to old API if new is not implemented but old is //Note the old has somewat different sematics if(s->iformat->read_seek || 1) - return av_seek_frame(s, stream_index, ts, flags | (ts - min_ts > (uint64_t)(max_ts - ts) ? AVSEEK_FLAG_BACKWARD : 0)); + return av_seek_frame(s, stream_index, ts, flags | ((uint64_t)ts - min_ts > (uint64_t)max_ts - ts ? AVSEEK_FLAG_BACKWARD : 0)); // try some generic seek like seek_frame_generic() but with new ts semantics } |