[lib/Fuzzer] add dfsan_weak_hook_memcmp, enable the test that uses it, simplify the...
[oota-llvm.git] / lib / Fuzzer / test / dfsan / DFSanMemcmpTest.cpp
index 8f909fcdba29e2c5be5e132884eb892f14403fae..510a24398005e94a39939531eb5bfceaa87f63d2 100644 (file)
@@ -1,8 +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 >= 10 && memcmp(Data, "0123456789", 10) == 0)
-    __builtin_trap();
+  if (Size >= 8 && memcmp(Data, "01234567", 8) == 0) {
+    fprintf(stderr, "BINGO\n");
+    exit(1);
+  }
 }