Fwd: [PATCH v2] stdio-common: Fix scanf parsing for NaN types [BZ #30647]

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Thu Oct 24 13:58:06 GMT 2024



On 24/10/24 05:05, Avinal Kumar wrote:
> 
> 
> ---------- Forwarded message ---------
> From: *Avinal Kumar* <avinal.xlvii@gmail.com <mailto:avinal.xlvii@gmail.com>>
> Date: Thu, Oct 24, 2024 at 1:33 PM
> Subject: Re: [PATCH v2] stdio-common: Fix scanf parsing for NaN types [BZ #30647]
> To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>>
> 
> 
> 
> 
> On Wed, Oct 23, 2024 at 11:07 PM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>> wrote:
> 
> 
>     Maybe also check for float and long double as well?
> 
> Did you mean to check NaN formatted as float and long double?

Yes, just to improve coverage.


> 
> 
> 
>     Currently style if not not add a whitespace for the macro, so just L_('(')
> 
> Ok
> 
> 
>     Use __glibc_unlikely here.
> 
> Ok
> 
> 
>     I am not sure if we can rely on this comparison for isalnum for all locales,
>     maybe a better strategy would be to do something like:
> 
>     #ifdef COMPILE_WSCAN
>     # define ISXALNUM(Ch)     iswalnum (Ch)
>     #else
>     # define ISXALNUM(Ch)     __iswalnum_l (Ch, loc)
>     #endif
>     [...]
>                               if (!(ISXALNUM (c) || c == L_('_') || c == L_(')')))
> 
>  
> Do we really want to check for all locales? I picked the check from  stdlib/strtod_nan_main.c (line 38), the comment mentions that the n-char-sequence should be ASCII characters.

Right, I think it fair to follow strtod here then.


More information about the Libc-alpha mailing list