diff --git a/libc/src/__support/str_to_float.h b/libc/src/__support/str_to_float.h --- a/libc/src/__support/str_to_float.h +++ b/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; diff --git a/libc/test/src/stdlib/strtof_test.cpp b/libc/test/src/stdlib/strtof_test.cpp --- a/libc/test/src/stdlib/strtof_test.cpp +++ b/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); }