The differential fuzzer for atof found a bug in glibc's handling of
hexadecimal rounding. Since we can't easily update glibc and we want to
avoid false positives when running the fuzzer, I've added an exception
to skip all hexadecimal subnormal cases.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/fuzzing/stdlib/atof_differential_fuzz.cpp | ||
---|---|---|
41 | Can there be a way to do this without using __llvm_libc::atof? |
libc/fuzzing/stdlib/atof_differential_fuzz.cpp | ||
---|---|---|
41 | Not really. We need to use some version of atof, either the system's or ours. The thing we're trying to detect here is hexadecimal subnormals, and the process for checking that is exactly the process for converting a string to a float. |
libc/fuzzing/stdlib/atof_differential_fuzz.cpp | ||
---|---|---|
41 | Let me rephrase my question: can you detect problem inputs using the system libc atof? |
switch to system atof for exception detection.
libc/fuzzing/stdlib/atof_differential_fuzz.cpp | ||
---|---|---|
41 | yes, either atof will work. |
libc/fuzzing/stdlib/atof_differential_fuzz.cpp | ||
---|---|---|
22 | A normal way to do this would be to: #ifdef LLVM_LIBC_... ... #else ... #endif And, let users define that macro in the build system. Also, the name of the macro can be more suggestive I think: LLVM_LIBC_ATOF_DIF_FUZZ_SKIP_GLIBC_HEX_SUBNORMAL_ERR. | |
54 | If the skip check function can take the size argument, can we skip before making the copy. |
address comments
libc/fuzzing/stdlib/atof_differential_fuzz.cpp | ||
---|---|---|
54 | not really, we need to add the null terminator to the string and to do that we need to copy it into something we can modify. |
A normal way to do this would be to:
And, let users define that macro in the build system. Also, the name of the macro can be more suggestive I think: LLVM_LIBC_ATOF_DIF_FUZZ_SKIP_GLIBC_HEX_SUBNORMAL_ERR.