summaryrefslogtreecommitdiff
path: root/lib/fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2017-12-12 23:11:28 +0000
committerKostya Serebryany <kcc@google.com>2017-12-12 23:11:28 +0000
commite4c546028442192e48480ff2d3d9e29ecc62774d (patch)
treeb1a48dfc35675aff67861a4d3c1bbb39d7505723 /lib/fuzzer/FuzzerLoop.cpp
parent8106beb37dc9b0d632c3596895bda21ef8108e7d (diff)
[libFuzzer] change the strategy for -experimental_len_control to grow max_len slower
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320531 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/FuzzerLoop.cpp')
-rw-r--r--lib/fuzzer/FuzzerLoop.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/fuzzer/FuzzerLoop.cpp b/lib/fuzzer/FuzzerLoop.cpp
index 6ed48e08b..5b451ca12 100644
--- a/lib/fuzzer/FuzzerLoop.cpp
+++ b/lib/fuzzer/FuzzerLoop.cpp
@@ -567,7 +567,6 @@ void Fuzzer::ReportNewCoverage(InputInfo *II, const Unit &U) {
NumberOfNewUnitsAdded++;
CheckExitOnSrcPosOrItem(); // Check only after the unit is saved to corpus.
LastCorpusUpdateRun = TotalNumberOfRuns;
- LastCorpusUpdateTime = system_clock::now();
}
// Tries detecting a memory leak on the particular input that we have just
@@ -758,18 +757,15 @@ void Fuzzer::Loop(const Vector<std::string> &CorpusDirs) {
// Update TmpMaxMutationLen
if (Options.ExperimentalLenControl) {
if (TmpMaxMutationLen < MaxMutationLen &&
- (TotalNumberOfRuns - LastCorpusUpdateRun >
- Options.ExperimentalLenControl &&
- duration_cast<seconds>(Now - LastCorpusUpdateTime).count() >= 1)) {
- LastCorpusUpdateRun = TotalNumberOfRuns;
- LastCorpusUpdateTime = Now;
+ TotalNumberOfRuns - LastCorpusUpdateRun >
+ Options.ExperimentalLenControl * Log(TmpMaxMutationLen)) {
TmpMaxMutationLen =
- Min(MaxMutationLen,
- TmpMaxMutationLen + Max(size_t(4), TmpMaxMutationLen / 8));
+ Min(MaxMutationLen, TmpMaxMutationLen + Log(TmpMaxMutationLen));
if (TmpMaxMutationLen <= MaxMutationLen)
Printf("#%zd\tTEMP_MAX_LEN: %zd (%zd %zd)\n", TotalNumberOfRuns,
TmpMaxMutationLen, Options.ExperimentalLenControl,
LastCorpusUpdateRun);
+ LastCorpusUpdateRun = TotalNumberOfRuns;
}
} else {
TmpMaxMutationLen = MaxMutationLen;