[vlc-devel] [PATCH v6 4/5] video_filter-sharpen: assert that SHARPEN_FRAME macro's maxval parameter is positive

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Apr 12 10:14:54 CEST 2017


On Tue, Apr 11, 2017, at 11:39 PM, victorien.lecouviour.tuffet at gmail.com
wrote:
> From: Victorien Le Couviour--Tuffet
> <victorien.lecouviour.tuffet at gmail.com>
> 
> ---
>  modules/video_filter/sharpen.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/modules/video_filter/sharpen.c
> b/modules/video_filter/sharpen.c
> index b35ea6b169..b596e9f94d 100644
> --- a/modules/video_filter/sharpen.c
> +++ b/modules/video_filter/sharpen.c
> @@ -37,6 +37,7 @@
>  # include "config.h"
>  #endif
>  
> +#include <assert.h>
>  #include <vlc_common.h>
>  #include <vlc_atomic.h>
>  #include <vlc_plugin.h>
> @@ -160,6 +161,7 @@ static void Destroy( vlc_object_t *p_this )
>  #define SHARPEN_FRAME(maxval, data_t)                                  
>  \
>      do                                                                 
>      \
>      {                                                                  
>      \
> +        assert((maxval) >= 0);                                         
> \
>          data_t *restrict p_src = (data_t *)p_pic->p[Y_PLANE].p_pixels; 
>          \
>          data_t *restrict p_out = (data_t
>          *)p_outpic->p[Y_PLANE].p_pixels; \
>          const unsigned data_sz = sizeof(data_t);                       
>          \
> -- 
> 2.12.0
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

Hi,

static_assert seems like a better choice here

Regards,

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list