Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 002f1b0

Browse files
committed
[libFuzzer] don't print large artifacts to stderr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249808 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 22d6013 commit 002f1b0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/Fuzzer/FuzzerLoop.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ void Fuzzer::StaticDeathCallback() {
4848

4949
void Fuzzer::DeathCallback() {
5050
Printf("DEATH:\n");
51-
Print(CurrentUnit, "\n");
52-
PrintUnitInASCIIOrTokens(CurrentUnit, "\n");
51+
if (CurrentUnit.size() <= kMaxUnitSizeToPrint) {
52+
Print(CurrentUnit, "\n");
53+
PrintUnitInASCIIOrTokens(CurrentUnit, "\n");
54+
}
5355
WriteUnitToFileWithPrefix(CurrentUnit, "crash-");
5456
}
5557

@@ -69,9 +71,10 @@ void Fuzzer::AlarmCallback() {
6971
Printf("ALARM: working on the last Unit for %zd seconds\n", Seconds);
7072
Printf(" and the timeout value is %d (use -timeout=N to change)\n",
7173
Options.UnitTimeoutSec);
72-
if (CurrentUnit.size() <= kMaxUnitSizeToPrint)
74+
if (CurrentUnit.size() <= kMaxUnitSizeToPrint) {
7375
Print(CurrentUnit, "\n");
74-
PrintUnitInASCIIOrTokens(CurrentUnit, "\n");
76+
PrintUnitInASCIIOrTokens(CurrentUnit, "\n");
77+
}
7578
WriteUnitToFileWithPrefix(CurrentUnit, "timeout-");
7679
exit(1);
7780
}
@@ -164,8 +167,6 @@ size_t Fuzzer::RunOne(const Unit &U) {
164167
TimeOfUnit >= Options.ReportSlowUnits) {
165168
TimeOfLongestUnitInSeconds = TimeOfUnit;
166169
Printf("Slowest unit: %zd s:\n", TimeOfLongestUnitInSeconds);
167-
if (U.size() <= kMaxUnitSizeToPrint)
168-
Print(U, "\n");
169170
WriteUnitToFileWithPrefix(U, "slow-unit-");
170171
}
171172
return Res;

0 commit comments

Comments
 (0)