summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Fuzzer/FuzzerDictionary.h2
-rw-r--r--llvm/lib/Fuzzer/test/CMakeLists.txt1
-rw-r--r--llvm/lib/Fuzzer/test/Memcmp64BytesTest.cpp20
-rw-r--r--llvm/lib/Fuzzer/test/fuzzer-traces-hooks.test2
4 files changed, 24 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerDictionary.h b/llvm/lib/Fuzzer/FuzzerDictionary.h
index f15ac930f2c..f5024b1aeec 100644
--- a/llvm/lib/Fuzzer/FuzzerDictionary.h
+++ b/llvm/lib/Fuzzer/FuzzerDictionary.h
@@ -51,7 +51,7 @@ private:
uint8_t Data[kMaxSize];
};
-typedef FixedWord<27> Word; // 28 bytes.
+typedef FixedWord<64> Word;
class DictionaryEntry {
public:
diff --git a/llvm/lib/Fuzzer/test/CMakeLists.txt b/llvm/lib/Fuzzer/test/CMakeLists.txt
index 890cbeef5e4..14d5f12f4e9 100644
--- a/llvm/lib/Fuzzer/test/CMakeLists.txt
+++ b/llvm/lib/Fuzzer/test/CMakeLists.txt
@@ -90,6 +90,7 @@ set(Tests
FourIndependentBranchesTest
FullCoverageSetTest
InitializeTest
+ Memcmp64BytesTest
MemcmpTest
LeakTest
LeakTimeoutTest
diff --git a/llvm/lib/Fuzzer/test/Memcmp64BytesTest.cpp b/llvm/lib/Fuzzer/test/Memcmp64BytesTest.cpp
new file mode 100644
index 00000000000..e81526b578a
--- /dev/null
+++ b/llvm/lib/Fuzzer/test/Memcmp64BytesTest.cpp
@@ -0,0 +1,20 @@
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+
+// Simple test for a fuzzer. The fuzzer must find a particular string.
+#include <cassert>
+#include <cstring>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ const char kString64Bytes[] =
+ "123456789 123456789 123456789 123456789 123456789 123456789 1234";
+ assert(sizeof(kString64Bytes) == 65);
+ if (Size >= 64 && memcmp(Data, kString64Bytes, 64) == 0) {
+ fprintf(stderr, "BINGO\n");
+ exit(1);
+ }
+ return 0;
+}
diff --git a/llvm/lib/Fuzzer/test/fuzzer-traces-hooks.test b/llvm/lib/Fuzzer/test/fuzzer-traces-hooks.test
index 14f4f8bfbb9..ff1bddb1e42 100644
--- a/llvm/lib/Fuzzer/test/fuzzer-traces-hooks.test
+++ b/llvm/lib/Fuzzer/test/fuzzer-traces-hooks.test
@@ -9,6 +9,8 @@ RUN: not LLVMFuzzer-StrncmpTest -seed=1 -runs=2000000 2>&1 | File
RUN: not LLVMFuzzer-StrcmpTest -seed=1 -runs=2000000 2>&1 | FileCheck %s
RUN: not LLVMFuzzer-StrstrTest -seed=1 -runs=2000000 2>&1 | FileCheck %s
+RUN: not LLVMFuzzer-Memcmp64BytesTest -seed=1 -runs=10000 2>&1 | FileCheck %s
+
RUN: LLVMFuzzer-RepeatedMemcmp -seed=11 -runs=100000 2>&1 | FileCheck %s --check-prefix=RECOMMENDED_DICT
RECOMMENDED_DICT:###### Recommended dictionary. ######
RECOMMENDED_DICT-DAG: "foo"
OpenPOWER on IntegriCloud