diff options
author | Kostya Serebryany <kcc@google.com> | 2016-08-30 01:30:14 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2016-08-30 01:30:14 +0000 |
commit | 4d22e4fcb92cf1f3af8fe0246694fa572971fd22 (patch) | |
tree | 3fceef14bd7a0ea159241f337ab290d1cd029a50 /llvm/lib/Fuzzer/test/DivTest.cpp | |
parent | b3177cea0a1b03a03a372c1ba48f7300d80b82b2 (diff) | |
download | llvm-4d22e4fcb92cf1f3af8fe0246694fa572971fd22.zip llvm-4d22e4fcb92cf1f3af8fe0246694fa572971fd22.tar.gz llvm-4d22e4fcb92cf1f3af8fe0246694fa572971fd22.tar.bz2 |
[libFuzzer] use trace-div and trace-gep for guided fuzzing, add tests
llvm-svn: 280046
Diffstat (limited to 'llvm/lib/Fuzzer/test/DivTest.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/test/DivTest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/test/DivTest.cpp b/llvm/lib/Fuzzer/test/DivTest.cpp new file mode 100644 index 0000000..63f6960 --- /dev/null +++ b/llvm/lib/Fuzzer/test/DivTest.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: find the interesting argument for div. +#include <assert.h> +#include <cstdint> +#include <cstring> +#include <cstddef> +#include <iostream> + +static volatile int Sink; + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + if (Size < 4) return 0; + int a; + memcpy(&a, Data, 4); + Sink = 12345678 / (987654 - a); + return 0; +} + |