On 2012-12-07 13:54:02 +0000, Måns Rullgård 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.

s/(without)/\1 undefined/ it still relies on defined over/underflow
behavior of unsigned types.

> Signed-off-by: Mans Rullgard <[email protected]>
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 12b054d..cd46caf 100644
> --- 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
>      //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
>  }

patch ok

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

Reply via email to