aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Fuzzer/test/StrstrTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Fuzzer/test/StrstrTest.cpp')
-rw-r--r--llvm/lib/Fuzzer/test/StrstrTest.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/test/StrstrTest.cpp b/llvm/lib/Fuzzer/test/StrstrTest.cpp
index 90d539b6..dd83953 100644
--- a/llvm/lib/Fuzzer/test/StrstrTest.cpp
+++ b/llvm/lib/Fuzzer/test/StrstrTest.cpp
@@ -9,8 +9,12 @@
#include <cstdlib>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ if (Size < 4) return 0;
std::string s(reinterpret_cast<const char*>(Data), Size);
- if (strstr(s.c_str(), "FUZZ") && strcasestr(s.c_str(), "aBcD")) {
+ if (strstr(s.c_str(), "FUZZ") &&
+ strcasestr(s.c_str(), "aBcD") &&
+ memmem(s.data(), s.size(), "kuku", 4)
+ ) {
fprintf(stderr, "BINGO\n");
exit(1);
}