mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-17 12:58:29 +00:00
[libc] Support underscores in NaN char sequences
Other libc implementations support underscores in NaN(n-char-sequence) strings. Us not supporting that is causing fuzz failures, so this patch solves the problem. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D156927
This commit is contained in:
parent
49d41de578
commit
ad844632b9
@ -1180,7 +1180,9 @@ LIBC_INLINE StrToNumResult<T> strtofloatingpoint(const char *__restrict src) {
|
||||
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;
|
||||
|
@ -201,4 +201,8 @@ TEST_F(LlvmLibcStrToFTest, NaNWithParenthesesValidSequenceInvalidNumberTests) {
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user