summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-09-10 00:15:41 +0000
committerKostya Serebryany <kcc@google.com>2016-09-10 00:15:41 +0000
commitb991cc1f0e6b7a5d2c4ab76f8140b32108550f5c (patch)
treefde2000e40f9fe653ee719650f5caa9c1e25382d /llvm/lib/Fuzzer/FuzzerLoop.cpp
parentfcdb1af655a80b4f1b4f17929235613216ebaaf5 (diff)
downloadbcm5719-llvm-b991cc1f0e6b7a5d2c4ab76f8140b32108550f5c.tar.gz
bcm5719-llvm-b991cc1f0e6b7a5d2c4ab76f8140b32108550f5c.zip
[libFuzzer] print a visible message if merge fails due to a crash
llvm-svn: 281122
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerLoop.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp
index 017ea03eaf7..c71d3022784 100644
--- a/llvm/lib/Fuzzer/FuzzerLoop.cpp
+++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp
@@ -188,7 +188,22 @@ void Fuzzer::StaticDeathCallback() {
F->DeathCallback();
}
+static void WarnOnUnsuccessfullMerge(bool DoWarn) {
+ Printf(
+ "***\n"
+ "***\n"
+ "***\n"
+ "*** NOTE: merge did not succeed due to a failure on one of the inputs.\n"
+ "*** You will need to filter out crashes from the corpus, e.g. like this:\n"
+ "*** for f in WITH_CRASHES/*; do ./fuzzer $f && cp $f NO_CRASHES; done\n"
+ "*** Future versions may have crash-resistant merge, stay tuned.\n"
+ "***\n"
+ "***\n"
+ "***\n");
+}
+
void Fuzzer::DumpCurrentUnit(const char *Prefix) {
+ WarnOnUnsuccessfullMerge(InMergeMode);
if (!CurrentUnitData) return; // Happens when running individual inputs.
MD.PrintMutationSequence();
Printf("; base unit: %s\n", Sha1ToString(BaseSha1).c_str());
@@ -612,6 +627,7 @@ void Fuzzer::Merge(const std::vector<std::string> &Corpora) {
Printf("Merge requires two or more corpus dirs\n");
return;
}
+ InMergeMode = true;
std::vector<std::string> ExtraCorpora(Corpora.begin() + 1, Corpora.end());
assert(Options.MaxLen > 0);
OpenPOWER on IntegriCloud