diff options
Diffstat (limited to 'compiler-rt/test/fuzzer/CustomCrossOverTest.cpp')
| -rw-r--r-- | compiler-rt/test/fuzzer/CustomCrossOverTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler-rt/test/fuzzer/CustomCrossOverTest.cpp b/compiler-rt/test/fuzzer/CustomCrossOverTest.cpp index b47a63e1d04..bd9afe774d3 100644 --- a/compiler-rt/test/fuzzer/CustomCrossOverTest.cpp +++ b/compiler-rt/test/fuzzer/CustomCrossOverTest.cpp @@ -15,12 +15,20 @@ static const char *Separator = "-########-"; static const char *Target = "A-########-B"; +static volatile int sink; + extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { assert(Data); std::string Str(reinterpret_cast<const char *>(Data), Size); static const size_t TargetHash = std::hash<std::string>{}(std::string(Target)); size_t StrHash = std::hash<std::string>{}(Str); + // Ensure we have 'A' and 'B' in the corpus. + if (Size == 1 && *Data == 'A') + sink++; + if (Size == 1 && *Data == 'B') + sink--; + if (TargetHash == StrHash) { std::cout << "BINGO; Found the target, exiting\n" << std::flush; exit(1); |

