diff options
author | Kostya Serebryany <kcc@google.com> | 2015-10-09 04:03:14 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2015-10-09 04:03:14 +0000 |
commit | e95022ac14c3faed1ac6a946b06807896e3dc1a9 (patch) | |
tree | da6e3cf4aebf57e135bcec37ced983dfcc71e554 /llvm/lib/Fuzzer | |
parent | bd5d1cdbb958a3a5a0484411b10fd6c8cdf5f132 (diff) | |
download | bcm5719-llvm-e95022ac14c3faed1ac6a946b06807896e3dc1a9.tar.gz bcm5719-llvm-e95022ac14c3faed1ac6a946b06807896e3dc1a9.zip |
[libFuzzer] don't print large artifacts to stderr
llvm-svn: 249808
Diffstat (limited to 'llvm/lib/Fuzzer')
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerLoop.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp index 76f65deb249..ec0b1176e28 100644 --- a/llvm/lib/Fuzzer/FuzzerLoop.cpp +++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp @@ -48,8 +48,10 @@ void Fuzzer::StaticDeathCallback() { void Fuzzer::DeathCallback() { Printf("DEATH:\n"); - Print(CurrentUnit, "\n"); - PrintUnitInASCIIOrTokens(CurrentUnit, "\n"); + if (CurrentUnit.size() <= kMaxUnitSizeToPrint) { + Print(CurrentUnit, "\n"); + PrintUnitInASCIIOrTokens(CurrentUnit, "\n"); + } WriteUnitToFileWithPrefix(CurrentUnit, "crash-"); } @@ -69,9 +71,10 @@ void Fuzzer::AlarmCallback() { Printf("ALARM: working on the last Unit for %zd seconds\n", Seconds); Printf(" and the timeout value is %d (use -timeout=N to change)\n", Options.UnitTimeoutSec); - if (CurrentUnit.size() <= kMaxUnitSizeToPrint) + if (CurrentUnit.size() <= kMaxUnitSizeToPrint) { Print(CurrentUnit, "\n"); - PrintUnitInASCIIOrTokens(CurrentUnit, "\n"); + PrintUnitInASCIIOrTokens(CurrentUnit, "\n"); + } WriteUnitToFileWithPrefix(CurrentUnit, "timeout-"); exit(1); } @@ -164,8 +167,6 @@ size_t Fuzzer::RunOne(const Unit &U) { TimeOfUnit >= Options.ReportSlowUnits) { TimeOfLongestUnitInSeconds = TimeOfUnit; Printf("Slowest unit: %zd s:\n", TimeOfLongestUnitInSeconds); - if (U.size() <= kMaxUnitSizeToPrint) - Print(U, "\n"); WriteUnitToFileWithPrefix(U, "slow-unit-"); } return Res; |