diff options
author | Kostya Serebryany <kcc@google.com> | 2019-02-16 01:23:41 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2019-02-16 01:23:41 +0000 |
commit | b6ca1e72594a3b79fbe37cd2e70f531c448f3e76 (patch) | |
tree | 2e87c51af15fc6d3002b37453a341755a1ccc28f /compiler-rt/lib/fuzzer/FuzzerLoop.cpp | |
parent | eac7c3ffaf5df3f61e5379cd3f61dc68a8414d67 (diff) | |
download | bcm5719-llvm-b6ca1e72594a3b79fbe37cd2e70f531c448f3e76.tar.gz bcm5719-llvm-b6ca1e72594a3b79fbe37cd2e70f531c448f3e76.zip |
[libFuzzer] make len_control less agressive: set the initial max len to the length of the largest seed. This was the original intent, but... Now, with a test, to ensure it stays this way
llvm-svn: 354191
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerLoop.cpp')
-rw-r--r-- | compiler-rt/lib/fuzzer/FuzzerLoop.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerLoop.cpp b/compiler-rt/lib/fuzzer/FuzzerLoop.cpp index 75dc600870a..b86512b1255 100644 --- a/compiler-rt/lib/fuzzer/FuzzerLoop.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerLoop.cpp @@ -153,7 +153,7 @@ Fuzzer::Fuzzer(UserCallback CB, InputCorpus &Corpus, MutationDispatcher &MD, if (!Options.OutputCorpus.empty() && Options.ReloadIntervalSec) EpochOfLastReadOfOutputCorpus = GetEpoch(Options.OutputCorpus); MaxInputLen = MaxMutationLen = Options.MaxLen; - TmpMaxMutationLen = Max(size_t(4), Corpus.MaxInputSize()); + TmpMaxMutationLen = 0; // Will be set once we load the corpus. AllocateCurrentUnitData(); CurrentUnitSize = 0; memset(BaseSha1, 0, sizeof(BaseSha1)); @@ -781,6 +781,10 @@ void Fuzzer::Loop(const Vector<std::string> &CorpusDirs, TPC.SetPrintNewPCs(Options.PrintNewCovPcs); TPC.SetPrintNewFuncs(Options.PrintNewCovFuncs); system_clock::time_point LastCorpusReload = system_clock::now(); + + TmpMaxMutationLen = + Min(MaxMutationLen, Max(size_t(4), Corpus.MaxInputSize())); + while (true) { auto Now = system_clock::now(); if (duration_cast<seconds>(Now - LastCorpusReload).count() >= |