[vlc-devel] [vlc-commits] modules: Adjust integer limits

Rémi Denis-Courmont remi at remlab.net
Fri Oct 14 18:26:28 CEST 2016


	Hello,

Le perjantaina 14. lokakuuta 2016, 18.22.00 EEST Hugo Beauzée-Luyssen a 
écrit :
> vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Oct 14
> 18:21:08 2016 +0200| [e908026c45d91a18b5a3835953edd47a822b4a40] |
> committer: Hugo Beauzée-Luyssen
> 
> modules: Adjust integer limits
> 
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e908026c45d91a18b5a
> > 3835953edd47a822b4a40
> ---
> 
>  src/modules/entry.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/modules/entry.c b/src/modules/entry.c
> index ae8e041..7698499 100644
> --- a/src/modules/entry.c
> +++ b/src/modules/entry.c
> @@ -129,8 +129,8 @@ static module_config_t *vlc_config_create (module_t
> *module, int type) memset (tab + confsize, 0, sizeof (tab[confsize]));
>      if (IsConfigIntegerType (type))
>      {
> -        tab[confsize].max.i = INT_MAX;
> -        tab[confsize].min.i = INT_MIN;
> +        tab[confsize].max.i = INT64_MAX;
> +        tab[confsize].min.i = INT64_MIN;

When 64-bits was added, we kept the INT boundaries by default.
In many cases we have legacy code along the lines of:

int a = var_InheritInteger(obj, "varname");

That can result in arithmetic overflow with your patch.

Maybe we should have helper macros to set the range (e.g. add_int64, 
add_uint32).


>      }
>      else if( IsConfigFloatType (type))
>      {
> 
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits


-- 
Rémi Denis-Courmont
Nonsponsored VLC developer
http://www.remlab.net/CV.pdf



More information about the vlc-devel mailing list