[PATCH v3 10/10] stdio-common: Reject real data w/o exponent digits in scanf [BZ #12701]

Joseph Myers josmyers@redhat.com
Tue Mar 25 22:18:50 GMT 2025


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

> From: Maciej W. Rozycki <macro@redhat.com>
> 
> Reject invalid formatted scanf real input data the exponent part of 
> which is comprised of an exponent introducing character, optionally 
> followed by a sign, and with no actual digits following.  Such data is a 
> prefix of, but not a matching input sequence and it is required by ISO C 
> to cause a matching failure.
> 
> Currently a matching success is instead incorrectly produced along with 
> the conversion result according to the input significand read and the 
> exponent of zero, with the significand and the exponent part wholly 
> consumed from input.
> 
> Correct an invalid `tstscanf.c' test accordingly that expects a matching 
> success for input data provided in the ISO C standard as an example for 
> a matching failure.
> 
> Enable input data that causes test failures without this fix in place.

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