summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/test/MemcmpTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Fuzzer/test/MemcmpTest.cpp')
-rw-r--r--llvm/lib/Fuzzer/test/MemcmpTest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/test/MemcmpTest.cpp b/llvm/lib/Fuzzer/test/MemcmpTest.cpp
new file mode 100644
index 00000000000..510a2439800
--- /dev/null
+++ b/llvm/lib/Fuzzer/test/MemcmpTest.cpp
@@ -0,0 +1,12 @@
+// Simple test for a fuzzer. The fuzzer must find a particular string.
+#include <cstring>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ if (Size >= 8 && memcmp(Data, "01234567", 8) == 0) {
+ fprintf(stderr, "BINGO\n");
+ exit(1);
+ }
+}
OpenPOWER on IntegriCloud