[llvm] r263518 - [libFuzzer] use max_len exactly equal to the max size of input. Fix 32-bit build

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 18:28:00 PDT 2016


Author: kcc
Date: Mon Mar 14 20:28:00 2016
New Revision: 263518

URL: http://llvm.org/viewvc/llvm-project?rev=263518&view=rev
Log:
[libFuzzer] use max_len exactly equal to the max size of input. Fix 32-bit build

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

Modified: llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp?rev=263518&r1=263517&r2=263518&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp Mon Mar 14 20:28:00 2016
@@ -270,6 +270,7 @@ static int FuzzerDriver(const std::vecto
     return RunInMultipleProcesses(Args, Flags.workers, Flags.jobs);
 
   const size_t kMaxSaneLen = 1 << 20;
+  const size_t kMinDefaultLen = 64;
   Fuzzer::FuzzingOptions Options;
   Options.Verbosity = Flags.verbosity;
   Options.MaxLen = Flags.max_len;
@@ -373,7 +374,7 @@ static int FuzzerDriver(const std::vecto
 
   if (Options.MaxLen == 0)
     F.SetMaxLen(
-        std::min(std::max(64UL, 2 * F.MaxUnitSizeInCorpus()), kMaxSaneLen));
+        std::min(std::max(kMinDefaultLen, F.MaxUnitSizeInCorpus()), kMaxSaneLen));
 
   if (F.CorpusSize() == 0)
     F.AddToCorpus(Unit());  // Can't fuzz empty corpus, so add an empty input.




More information about the llvm-commits mailing list