[PATCH v3 07/10] stdio-common: Also reject exp char w/o significand in i18n scanf [BZ #13988]

Joseph Myers josmyers@redhat.com
Tue Mar 25 21:33:42 GMT 2025


On Tue, 25 Mar 2025, Maciej W. Rozycki wrote:

> From: Maciej W. Rozycki <macro@redhat.com>
> 
> Fix the handling of real 'scanf' input such as "+.e" as per BZ #13988 
> for the i18n case as well, complementing commit 6ecec3b616ae ("Don't 
> accept exp char without preceding digits in scanf float parsing"), where 
> the 'e' character is incorrectly consumed from input.  Add a test case 
> matching stdio-common/bug26.c, with bits from localedata/tst-sscanf.c.
> ---
> This is needed to prevent a localedata/tst-sscanf regression with 10/10,
> but it is of course a fix for a bug on its own.  I don't know why GCC is 
> unhappy with the 'I' modifier, this doesn't appear documented anywhere.

I added GCC format checking support for the 'I' scanf flag in 2000 (GCC 
commit 4831bc8477cc012c0be6c8da357537016877cd6a).  At that time, it was 
only supported for integer formats in glibc; support for 'I' with 
floating-point formats was added in 2007 (glibc commit 
ecb72bd5b640497474ceae8d5e991b88c0c032e2, so glibc 2.6 and later).

Please file a GCC bug report for adding format checking support for 'I' 
with decimal floating scanf formats, and add a comment giving that bug 
number on the DIAG_PUSH_NEEDS_COMMENT call.  With that comment giving the 
GCC bug number added, this patch is OK:

Reviewed-by: Joseph Myers <josmyers@redhat.com>

-- 
Joseph S. Myers
josmyers@redhat.com



More information about the Libc-alpha mailing list