[vlc-devel] [PATCH] avi: Fix potential integer overflow

Rémi Denis-Courmont remi at remlab.net
Sun Nov 12 10:53:48 CET 2017


On dimanche 12 novembre 2017 10:03:33 EET Hugo Beauzée-Luyssen wrote:
> ---
>  modules/demux/avi/avi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
> index 190a6be209..f8af53bcd9 100644
> --- a/modules/demux/avi/avi.c
> +++ b/modules/demux/avi/avi.c
> @@ -1800,10 +1800,10 @@ static mtime_t AVI_GetDPTS( avi_track_t *tk, int64_t
> i_count ) if( !tk->i_rate )
>          return i_dpts;
> 
> -    i_dpts = (mtime_t)( (int64_t)1000000 *
> -                        (int64_t)i_count *
> +    i_dpts = (mtime_t)( (int64_t)i_count *
>                          (int64_t)tk->i_scale /
>                          (int64_t)tk->i_rate );
> +    i_dpts *= (int64_t)1000000;
> 
>      if( tk->i_samplesize )
>      {

This ruins the precision. Use date_t maybe? Also CLOCK_FREQ.

-- 
Rémi Denis-Courmont


More information about the vlc-devel mailing list