[llvm] r266670 - [libFuzzer] warn if the corpus is empty

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 18 14:14:12 PDT 2016


Author: kcc
Date: Mon Apr 18 16:14:11 2016
New Revision: 266670

URL: http://llvm.org/viewvc/llvm-project?rev=266670&view=rev
Log:
[libFuzzer] warn if the corpus is empty

Modified:
    llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
    llvm/trunk/lib/Fuzzer/test/fuzzer.test

Modified: llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp?rev=266670&r1=266669&r2=266670&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp Mon Apr 18 16:14:11 2016
@@ -376,8 +376,11 @@ static int FuzzerDriver(const std::vecto
     F.SetMaxLen(
         std::min(std::max(kMinDefaultLen, F.MaxUnitSizeInCorpus()), kMaxSaneLen));
 
-  if (F.CorpusSize() == 0)
+  if (F.CorpusSize() == 0) {
     F.AddToCorpus(Unit());  // Can't fuzz empty corpus, so add an empty input.
+    if (Options.Verbosity)
+      Printf("INFO: A corpus is not provided, starting from an empty corpus\n");
+  }
   F.ShuffleAndMinimize();
   if (Flags.drill)
     F.Drill();

Modified: llvm/trunk/lib/Fuzzer/test/fuzzer.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/fuzzer.test?rev=266670&r1=266669&r2=266670&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/fuzzer.test (original)
+++ llvm/trunk/lib/Fuzzer/test/fuzzer.test Mon Apr 18 16:14:11 2016
@@ -118,3 +118,4 @@ FD_MASK_3: INITED
 
 RUN: LLVMFuzzer-SimpleTest -runs=10 --max_len=100 2>&1 | FileCheck %s --check-prefix=DASH_DASH
 DASH_DASH: WARNING: did you mean '-max_len=100' (single dash)?
+DASH_DASH: INFO: A corpus is not provided, starting from an empty corpus




More information about the llvm-commits mailing list