hanchenye-llvm-project/compiler-rt/lib/fuzzer/tests
Hans Wennborg c7bd643599 [libFuzzer] Use octal instead of hex escape sequences in PrintASCII
Previously, PrintASCII would print the string "\ta" as "\x09a". However,
in C/C++ those strings are not the same: the trailing 'a' is part of the
escape sequence, which means it's equivalent to "\x9a". This is an
annoying quirk of the standard. (See
https://eel.is/c++draft/lex.ccon#nt:hexadecimal-escape-sequence)

To fix this, output three-digit octal escape sequences instead. Since
octal escapes are limited to max three digits, this avoids the problem
of subsequent characters unintentionally becoming part of the escape
sequence.

Dictionary files still use the non-C-compatible hex escapes, but I
believe we can't change the format since it comes from AFL, and
libfuzzer never writes such files, it only has to read them, so they're
not affected by this change.

Differential revision: https://reviews.llvm.org/D110920
2021-10-04 11:29:54 +02:00
..
CMakeLists.txt [compiler-rt][fuzzer] Do not link in libc++ in tests and disable exceptions 2021-09-08 11:45:52 -07:00
FuzzedDataProviderUnittest.cpp [compiler-rt] FuzzedDataProvider: Add PickValueInArray for std::array 2020-12-30 10:25:26 -08:00
FuzzerUnittest.cpp [libFuzzer] Use octal instead of hex escape sequences in PrintASCII 2021-10-04 11:29:54 +02:00