summaryrefslogtreecommitdiff
path: root/lib/fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2017-11-09 20:44:08 +0000
committerMatt Morehouse <mascasa@google.com>2017-11-09 20:44:08 +0000
commit8630529c291d7974dca280343e1f73321b6c6ad8 (patch)
tree73f3ef02f45ac9e048652f51473c2ca331c24950 /lib/fuzzer/FuzzerLoop.cpp
parent5646b9ef2068f1577569226326f62d90e2de5f09 (diff)
[libFuzzer] Don't add leaking inputs to corpus.
Reviewers: kcc Reviewed By: kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39850 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317831 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/FuzzerLoop.cpp')
-rw-r--r--lib/fuzzer/FuzzerLoop.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/fuzzer/FuzzerLoop.cpp b/lib/fuzzer/FuzzerLoop.cpp
index 97bc1c62b..81e609e33 100644
--- a/lib/fuzzer/FuzzerLoop.cpp
+++ b/lib/fuzzer/FuzzerLoop.cpp
@@ -641,11 +641,12 @@ void Fuzzer::MutateAndTestOne() {
assert(NewSize <= CurrentMaxMutationLen && "Mutator return oversized unit");
Size = NewSize;
II.NumExecutedMutations++;
- if (RunOne(CurrentUnitData, Size, /*MayDeleteFile=*/true, &II))
- ReportNewCoverage(&II, {CurrentUnitData, CurrentUnitData + Size});
+ bool NewCov = RunOne(CurrentUnitData, Size, /*MayDeleteFile=*/true, &II);
TryDetectingAMemoryLeak(CurrentUnitData, Size,
/*DuringInitialCorpusExecution*/ false);
+ if (NewCov)
+ ReportNewCoverage(&II, {CurrentUnitData, CurrentUnitData + Size});
}
}