summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2018-07-03 21:17:55 +0000
committerKostya Serebryany <kcc@google.com>2018-07-03 21:17:55 +0000
commitd6bbae10f0314a43a6782fbebc5bb9d35ffc486b (patch)
tree2a7fd608976f9cc927a1849ffefbeec4a575006d /test
parentb68f1aed8ac49ce1a6763490ed861f3f1b12a982 (diff)
[libFuzzer] add a tiny and surprisingly hard puzzle
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336229 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/fuzzer/ThreeBytes.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/fuzzer/ThreeBytes.cpp b/test/fuzzer/ThreeBytes.cpp
new file mode 100644
index 000000000..754a5b0b5
--- /dev/null
+++ b/test/fuzzer/ThreeBytes.cpp
@@ -0,0 +1,14 @@
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+
+// Find FUZ
+#include <cstddef>
+#include <cstdint>
+#include <cstdlib>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ if (Size < 3) return 0;
+ uint32_t x = Data[0] + 251 * Data[1] + 251 * 251 * Data[2];
+ if (x == 'F' + 251 * 'U' + 251 * 251 * 'Z') abort();
+ return 0;
+}