diff options
Diffstat (limited to 'llvm/lib/Fuzzer/test/CustomCrossOverTest.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/test/CustomCrossOverTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/test/CustomCrossOverTest.cpp b/llvm/lib/Fuzzer/test/CustomCrossOverTest.cpp index 2ab5781155f..b624088b902 100644 --- a/llvm/lib/Fuzzer/test/CustomCrossOverTest.cpp +++ b/llvm/lib/Fuzzer/test/CustomCrossOverTest.cpp @@ -15,10 +15,16 @@ static const char *Separator = "-_^_-"; static const char *Target = "012-_^_-abc"; +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); + // Ensure that two different elements exist in the corpus. + if (Size && Data[0] == '0') sink++; + if (Size && Data[0] == 'a') sink--; + if (Str.find(Target) != std::string::npos) { std::cout << "BINGO; Found the target, exiting\n"; exit(1); |