summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Fuzzer/test')
-rw-r--r--llvm/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp2
-rw-r--r--llvm/lib/Fuzzer/test/FourIndependentBranchesTest.cpp1
-rw-r--r--llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp1
-rw-r--r--llvm/lib/Fuzzer/test/SimpleHashTest.cpp2
-rw-r--r--llvm/lib/Fuzzer/test/SingleStrncmpTest.cpp1
-rw-r--r--llvm/lib/Fuzzer/test/fuzzer-dirs.test8
-rw-r--r--llvm/lib/Fuzzer/test/inline-8bit-counters.test2
7 files changed, 12 insertions, 5 deletions
diff --git a/llvm/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp b/llvm/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
index dfb6007b797..b5a61ddca71 100644
--- a/llvm/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
+++ b/llvm/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
@@ -9,7 +9,7 @@
#include <cstring>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- if (Size < 16) return 0;
+ if (Size < 16 || Size > 64) return 0;
int64_t x;
uint64_t y;
memcpy(&x, Data, sizeof(x));
diff --git a/llvm/lib/Fuzzer/test/FourIndependentBranchesTest.cpp b/llvm/lib/Fuzzer/test/FourIndependentBranchesTest.cpp
index bbf5ea235c7..ba963d9b1de 100644
--- a/llvm/lib/Fuzzer/test/FourIndependentBranchesTest.cpp
+++ b/llvm/lib/Fuzzer/test/FourIndependentBranchesTest.cpp
@@ -8,6 +8,7 @@
#include <iostream>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ if (Size > 64) return 0;
int bits = 0;
if (Size > 0 && Data[0] == 'F') bits |= 1;
if (Size > 1 && Data[1] == 'U') bits |= 2;
diff --git a/llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp b/llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp
index d0954296362..37eeede7cbf 100644
--- a/llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp
+++ b/llvm/lib/Fuzzer/test/ShrinkControlFlowTest.cpp
@@ -11,6 +11,7 @@
static volatile int Sink;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ if (Size > 64) return 0;
int8_t Ids[256];
memset(Ids, -1, sizeof(Ids));
for (size_t i = 0; i < Size; i++)
diff --git a/llvm/lib/Fuzzer/test/SimpleHashTest.cpp b/llvm/lib/Fuzzer/test/SimpleHashTest.cpp
index 99e96cb25dc..a3f4211ebee 100644
--- a/llvm/lib/Fuzzer/test/SimpleHashTest.cpp
+++ b/llvm/lib/Fuzzer/test/SimpleHashTest.cpp
@@ -26,7 +26,7 @@ static uint32_t simple_hash(const uint8_t *Data, size_t Size) {
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- if (Size < 14)
+ if (Size < 14 || Size > 64)
return 0;
uint32_t Hash = simple_hash(&Data[0], Size - 4);
diff --git a/llvm/lib/Fuzzer/test/SingleStrncmpTest.cpp b/llvm/lib/Fuzzer/test/SingleStrncmpTest.cpp
index b302670fb74..b38c7995d8f 100644
--- a/llvm/lib/Fuzzer/test/SingleStrncmpTest.cpp
+++ b/llvm/lib/Fuzzer/test/SingleStrncmpTest.cpp
@@ -8,6 +8,7 @@
#include <cstring>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ if (Size > 64) return 0;
char *S = (char*)Data;
volatile auto Strncmp = &(strncmp); // Make sure strncmp is not inlined.
if (Size >= 6 && !Strncmp(S, "qwerty", 6)) {
diff --git a/llvm/lib/Fuzzer/test/fuzzer-dirs.test b/llvm/lib/Fuzzer/test/fuzzer-dirs.test
index 3de64f278f5..622ff5da3a2 100644
--- a/llvm/lib/Fuzzer/test/fuzzer-dirs.test
+++ b/llvm/lib/Fuzzer/test/fuzzer-dirs.test
@@ -5,9 +5,13 @@ RUN: echo b > %t/SUB1/SUB2/b
RUN: echo c > %t/SUB1/SUB2/SUB3/c
RUN: LLVMFuzzer-SimpleTest %t/SUB1 -runs=0 2>&1 | FileCheck %s --check-prefix=SUBDIRS
SUBDIRS: READ units: 3
-RUN: echo -n zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz > %t/SUB1/long
+RUN: echo -n zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz > %t/SUB1/f64
+RUN: cat %t/SUB1/f64 %t/SUB1/f64 %t/SUB1/f64 %t/SUB1/f64 > %t/SUB1/f256
+RUN: cat %t/SUB1/f256 %t/SUB1/f256 %t/SUB1/f256 %t/SUB1/f256 > %t/SUB1/f1024
+RUN: cat %t/SUB1/f1024 %t/SUB1/f1024 %t/SUB1/f1024 %t/SUB1/f1024 > %t/SUB1/f4096
+RUN: cat %t/SUB1/f4096 %t/SUB1/f4096 > %t/SUB1/f8192
RUN: LLVMFuzzer-SimpleTest %t/SUB1 -runs=0 2>&1 | FileCheck %s --check-prefix=LONG
-LONG: INFO: -max_len is not provided, using 93
+LONG: INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 8192 bytes
RUN: rm -rf %t/SUB1
RUN: not LLVMFuzzer-SimpleTest NONEXISTENT_DIR 2>&1 | FileCheck %s --check-prefix=NONEXISTENT_DIR
diff --git a/llvm/lib/Fuzzer/test/inline-8bit-counters.test b/llvm/lib/Fuzzer/test/inline-8bit-counters.test
index 4b6ae837444..8747af81451 100644
--- a/llvm/lib/Fuzzer/test/inline-8bit-counters.test
+++ b/llvm/lib/Fuzzer/test/inline-8bit-counters.test
@@ -1,4 +1,4 @@
REQUIRES: linux
CHECK: INFO: Loaded 1 modules with {{.*}} inline 8-bit counters
CHECK: BINGO
-RUN: LLVMFuzzer-SimpleTest-Inline8bitCounters -runs=100000 -seed=1 2>&1 | FileCheck %s
+RUN: LLVMFuzzer-SimpleTest-Inline8bitCounters -runs=1000000 -seed=1 2>&1 | FileCheck %s
OpenPOWER on IntegriCloud