This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Mangle NULL pointers in iconv/gconv [BZ #22025]
- From: Andreas Schwab <schwab at suse dot de>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, Patsy Franklin <pfrankli at redhat dot com>, Jeff Law <law at redhat dot com>
- Date: Tue, 29 Aug 2017 15:52:02 +0200
- Subject: Re: [PATCH] Mangle NULL pointers in iconv/gconv [BZ #22025]
- Authentication-results: sourceware.org; auth=none
- References: <50ea6b93-b58a-fdad-c178-a188ff6b6728@redhat.com>
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."