]> sourceware.org Git - glibc.git/commit
stdio-common: Fix scanf parsing for NaN types [BZ #30647]
authorAvinal Kumar <avinal.xlvii@gmail.com>
Fri, 25 Oct 2024 10:18:27 +0000 (15:48 +0530)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 25 Oct 2024 18:05:06 +0000 (15:05 -0300)
commit04e8698fcca7d1e932bc54f5b60e1bbce2e87601
tree43b2939f0ef8a5abf808806137cd1e30b7217a28
parentac73067cb7a328bf106ecd041c020fc61be7e087
stdio-common: Fix scanf parsing for NaN types [BZ #30647]

The scanf family of functions like sscanf and fscanf currently
ignore nan() and nan(n-char-sequence).  This happens because
__vfscanf_internal only checks for 'nan'.

This commit adds support for all valid nan types i.e.  nan, nan()
and nan(n-char-sequence), where n-char-sequence can be
[a-zA-Z0-9_]+, thus fixing the bug 30647.  Any other representation
of NaN should result in conversion error.

New tests are also added to verify the correct parsing of NaN types for
float, double and long double formats.

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
stdio-common/Makefile
stdio-common/tst-scanf-nan.c [new file with mode: 0644]
stdio-common/vfscanf-internal.c
This page took 0.035016 seconds and 5 git commands to generate.