This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Mangle NULL pointers in iconv/gconv [BZ #22025]


On Aug 29 2017, Florian Weimer <fweimer@redhat.com> wrote:

> diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c
> index 7893fadba1..b748467de5 100644
> --- a/iconv/gconv_db.c
> +++ b/iconv/gconv_db.c
> @@ -179,16 +179,15 @@ free_derivation (void *p)
>    size_t cnt;
>  
>    for (cnt = 0; cnt < deriv->nsteps; ++cnt)
> -    if (deriv->steps[cnt].__counter > 0
> -	&& deriv->steps[cnt].__end_fct != NULL)
> +    if ((deriv->steps[cnt].__counter > 0)
> +	&& (deriv->steps[cnt].__shlib_handle != NULL))

Please remove the redundant parens.

> @@ -332,8 +325,7 @@ gen_steps (struct derivation_step *best, const char *toset,
>  		    }
>  
>  # ifdef PTR_MANGLE
> -		  if (result[step_cnt].__btowc_fct != NULL)
> -		    PTR_MANGLE (result[step_cnt].__btowc_fct);
> +		  PTR_MANGLE (result[step_cnt].__btowc_fct);
>  # endif

That needs to be mangled even if there is no init_fct.

> @@ -415,16 +407,15 @@ increment_counter (struct __gconv_step *steps, size_t nsteps)
>  
>  	  /* Call the init function.  */
>  	  __gconv_init_fct init_fct = step->__init_fct;
> +#ifdef PTR_DEMANGLE
> +	  PTR_DEMANGLE (init_fct);
> +#endif
>  	  if (init_fct != NULL)
>  	    {
> -#ifdef PTR_DEMANGLE
> -	      PTR_DEMANGLE (init_fct);
> -#endif
>  	      DL_CALL_FCT (init_fct, (step));
>  
>  #ifdef PTR_MANGLE
> -	      if (step->__btowc_fct != NULL)
> -		PTR_MANGLE (step->__btowc_fct);
> +	      PTR_MANGLE (step->__btowc_fct);
>  #endif

Likewise.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]