On Fri, Dec 07, 2012 at 01:54:02PM +0000, Mans Rullgard wrote:
> 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.
> 
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -1762,7 +1762,7 @@ int avformat_seek_file(AVFormatContext *s, int 
> stream_index, int64_t min_ts, int
>      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));

I had looked at this IOC warning earlier today myself.
Your fix is probably correct.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to