From 04e8698fcca7d1e932bc54f5b60e1bbce2e87601 Mon Sep 17 00:00:00 2001 From: Avinal Kumar Date: Fri, 25 Oct 2024 15:48:27 +0530 Subject: 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 Reviewed-by: Adhemerval Zanella --- stdio-common/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'stdio-common/Makefile') diff --git a/stdio-common/Makefile b/stdio-common/Makefile index 88105b3c1b..a166eb7cf8 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -261,6 +261,7 @@ tests := \ tst-scanf-binary-gnu89 \ tst-scanf-bz27650 \ tst-scanf-intn \ + tst-scanf-nan \ tst-scanf-round \ tst-scanf-to_inpunct \ tst-setvbuf1 \ -- cgit v1.2.3