]> granicus.if.org Git - llvm/commitdiff
[libFuzzer] change several tests to not limit the max len: with reduce_inputs=1 they...
authorKostya Serebryany <kcc@google.com>
Wed, 19 Jul 2017 23:45:46 +0000 (23:45 +0000)
committerKostya Serebryany <kcc@google.com>
Wed, 19 Jul 2017 23:45:46 +0000 (23:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308553 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
lib/Fuzzer/test/FourIndependentBranchesTest.cpp
lib/Fuzzer/test/ShrinkControlFlowTest.cpp
lib/Fuzzer/test/SimpleHashTest.cpp
lib/Fuzzer/test/SingleStrncmpTest.cpp
lib/Fuzzer/test/shrink.test

index b5a61ddca715400eeeaad87e8e945a6975544d3b..dfb6007b7970d9f8adf169d7b2635c642c39000c 100644 (file)
@@ -9,7 +9,7 @@
 #include <cstring>
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
-  if (Size < 16 || Size > 64) return 0;
+  if (Size < 16) return 0;
   int64_t x;
   uint64_t y;
   memcpy(&x, Data, sizeof(x));
index ba963d9b1de882fcb11e4c01ea691faeb84392b1..bbf5ea235c7af8595a57a7401e10a9eb8b1357d3 100644 (file)
@@ -8,7 +8,6 @@
 #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;
index 37eeede7cbffc5c4b675503123583333b86aa7b3..d095429636266d7d41dd237ab1f109ab4135ca65 100644 (file)
@@ -11,7 +11,6 @@
 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++)
index a3f4211ebeeffe4fb8ce9c7cb1af020bc4a41f26..99e96cb25dcd55551b136c7d27834cf2eb835ec0 100644 (file)
@@ -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 || Size > 64)
+  if (Size < 14)
     return 0;
 
   uint32_t Hash = simple_hash(&Data[0], Size - 4);
index b38c7995d8ff83ea491929e127bd69e9fa450c33..47298763f28fa4a9677147344f581f1d87b364e8 100644 (file)
@@ -8,8 +8,7 @@
 #include <cstring>
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
-  if (Size > 64) return 0;
-  char *S = (char*)Data;
+  const char *S = (const char*)Data;
   volatile auto Strncmp = &(strncmp);   // Make sure strncmp is not inlined.
   if (Size >= 6 && !Strncmp(S, "qwerty", 6)) {
     fprintf(stderr, "BINGO\n");
index 79355a8f71a5b0f6c1f03e0130992fdba11a98a1..b58aa80e470c027e19abb622e9201e08cd3c3226 100644 (file)
@@ -1,5 +1,6 @@
 RUN: LLVMFuzzer-ShrinkControlFlowTest -seed=1 -exit_on_item=0eb8e4ed029b774d80f2b66408203801cb982a60 -runs=1000000  -shrink=1 -reduce_inputs=0 2>&1 | FileCheck %s --check-prefix=SHRINK1
-RUN: LLVMFuzzer-ShrinkControlFlowTest -seed=1 -exit_on_item=0eb8e4ed029b774d80f2b66408203801cb982a60 -runs=1000000 -shrink=0 -reduce_inputs=0 2>&1 | FileCheck %s --check-prefix=SHRINK0
+# Limit max_len to run this negative test faster.
+RUN: LLVMFuzzer-ShrinkControlFlowTest -seed=1 -exit_on_item=0eb8e4ed029b774d80f2b66408203801cb982a60 -runs=1000000 -shrink=0 -reduce_inputs=0 -max_len=64 2>&1 | FileCheck %s --check-prefix=SHRINK0
 RUN: LLVMFuzzer-ShrinkValueProfileTest -seed=1 -exit_on_item=aea2e3923af219a8956f626558ef32f30a914ebc -runs=100000 -shrink=1 -reduce_inputs=0 -use_value_profile=1 2>&1 | FileCheck %s --check-prefix=SHRINK1_VP
 
 SHRINK0: Done 1000000 runs in