[libc-commits] [PATCH] D156927: [libc] Support underscores in NaN char sequences
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Aug 2 13:03:07 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGad844632b932: [libc] Support underscores in NaN char sequences (authored by michaelrj).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156927/new/
https://reviews.llvm.org/D156927
Files:
libc/src/__support/str_to_float.h
libc/test/src/stdlib/strtof_test.cpp
Index: libc/test/src/stdlib/strtof_test.cpp
===================================================================
--- libc/test/src/stdlib/strtof_test.cpp
+++ libc/test/src/stdlib/strtof_test.cpp
@@ -201,4 +201,8 @@
run_test("NaN(1a)", 7, 0x7fc00000);
run_test("NaN(asdf)", 9, 0x7fc00000);
run_test("NaN(1A1)", 8, 0x7fc00000);
+ run_test("NaN(why_does_this_work)", 23, 0x7fc00000);
+ run_test(
+ "NaN(1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_)",
+ 68, 0x7fc00000);
}
Index: libc/src/__support/str_to_float.h
===================================================================
--- libc/src/__support/str_to_float.h
+++ libc/src/__support/str_to_float.h
@@ -1180,7 +1180,9 @@
if (src[index] == '(') {
size_t left_paren = index;
++index;
- while (isalnum(src[index]))
+ // Apparently it's common for underscores to also be accepted. No idea
+ // why, but it's causing fuzz failures.
+ while (isalnum(src[index]) || src[index] == '_')
++index;
if (src[index] == ')') {
++index;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156927.546583.patch
Type: text/x-patch
Size: 1100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230802/9e8e19af/attachment.bin>
More information about the libc-commits
mailing list