aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-04-18 22:50:39 +0000
committerKostya Serebryany <kcc@google.com>2016-04-18 22:50:39 +0000
commitebb932d0607bd79fa63e0eddd2e014243e756949 (patch)
tree8453f27adce30aa56800a70af94fee736f475a2c /llvm/lib/Fuzzer/FuzzerLoop.cpp
parent43d1e453479fe60046c06c83c7020a2a52ce9748 (diff)
downloadllvm-ebb932d0607bd79fa63e0eddd2e014243e756949.zip
llvm-ebb932d0607bd79fa63e0eddd2e014243e756949.tar.gz
llvm-ebb932d0607bd79fa63e0eddd2e014243e756949.tar.bz2
[libFuzzer] try to print correct time in seconds when reporting a timeout. Don't report timeouts while still loading the corpus.
llvm-svn: 266693
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerLoop.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp
index afdc9fa..3b00e47 100644
--- a/llvm/lib/Fuzzer/FuzzerLoop.cpp
+++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp
@@ -280,7 +280,6 @@ void Fuzzer::ShuffleAndMinimize() {
}
bool Fuzzer::RunOne(const uint8_t *Data, size_t Size) {
- UnitStartTime = system_clock::now();
TotalNumberOfRuns++;
PrepareCoverageBeforeRun();
@@ -312,6 +311,7 @@ void Fuzzer::RunOneAndUpdateCorpus(uint8_t *Data, size_t Size) {
}
void Fuzzer::ExecuteCallback(const uint8_t *Data, size_t Size) {
+ UnitStartTime = system_clock::now();
// We copy the contents of Unit into a separate heap buffer
// so that we reliably find buffer overflows in it.
std::unique_ptr<uint8_t[]> DataCopy(new uint8_t[Size]);
@@ -320,10 +320,10 @@ void Fuzzer::ExecuteCallback(const uint8_t *Data, size_t Size) {
CurrentUnitData = DataCopy.get();
CurrentUnitSize = Size;
int Res = CB(DataCopy.get(), Size);
+ CurrentUnitSize = 0;
+ CurrentUnitData = nullptr;
(void)Res;
assert(Res == 0);
- CurrentUnitData = nullptr;
- CurrentUnitSize = 0;
}
size_t Fuzzer::RecordBlockCoverage() {