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

Florian Weimer fweimer@redhat.com
Tue Aug 29 14:55:00 GMT 2017


On 08/29/2017 03:52 PM, Andreas Schwab wrote:
> 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.

Thanks.  I'm attaching a patch to fix this.  Okay?

Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gconv-mangle2.patch
Type: text/x-patch
Size: 1837 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20170829/a252c4c3/attachment.bin>


More information about the Libc-alpha mailing list