aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Fuzzer/test/MemcmpTest.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-07-30 01:34:58 +0000
committerKostya Serebryany <kcc@google.com>2015-07-30 01:34:58 +0000
commit0e776a2250e0c269aefae5d04598199545ce9bd2 (patch)
treeeb37d8e42180b468b84f5f7e281a369bcc3c3254 /llvm/lib/Fuzzer/test/MemcmpTest.cpp
parent00bd0a403419952b46ae2e679dc71f8d044f115c (diff)
downloadllvm-0e776a2250e0c269aefae5d04598199545ce9bd2.zip
llvm-0e776a2250e0c269aefae5d04598199545ce9bd2.tar.gz
llvm-0e776a2250e0c269aefae5d04598199545ce9bd2.tar.bz2
[libFuzzer] implement memcmp hook for data-flow-guided fuzzing (w/o dfsan), extend the memcmp fuzzer test
llvm-svn: 243603
Diffstat (limited to 'llvm/lib/Fuzzer/test/MemcmpTest.cpp')
-rw-r--r--llvm/lib/Fuzzer/test/MemcmpTest.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Fuzzer/test/MemcmpTest.cpp b/llvm/lib/Fuzzer/test/MemcmpTest.cpp
index 510a243..cabdff8f 100644
--- a/llvm/lib/Fuzzer/test/MemcmpTest.cpp
+++ b/llvm/lib/Fuzzer/test/MemcmpTest.cpp
@@ -5,8 +5,13 @@
#include <cstdlib>
extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ // TODO: check other sizes.
if (Size >= 8 && memcmp(Data, "01234567", 8) == 0) {
- fprintf(stderr, "BINGO\n");
- exit(1);
+ if (Size >= 12 && memcmp(Data + 8, "ABCD", 4) == 0) {
+ if (Size >= 14 && memcmp(Data + 12, "XY", 2) == 0) {
+ fprintf(stderr, "BINGO\n");
+ exit(1);
+ }
+ }
}
}