Commit 8470e6c9 authored by Michael Niedermayer's avatar Michael Niedermayer

lavf/avformat_seek_file: fix harmless integer overflow

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 386d60f9
......@@ -2020,7 +2020,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 somewhat different semantics
if (s->iformat->read_seek || 1) {
int dir = (ts - min_ts > (uint64_t)(max_ts - ts) ? AVSEEK_FLAG_BACKWARD : 0);
int dir = (ts - (uint64_t)min_ts > (uint64_t)max_ts - ts ? AVSEEK_FLAG_BACKWARD : 0);
int ret = av_seek_frame(s, stream_index, ts, flags | dir);
if (ret<0 && ts != min_ts && max_ts != ts) {
ret = av_seek_frame(s, stream_index, dir ? max_ts : min_ts, flags | dir);
......
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