summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2017-11-15 16:42:52 +0000
committerKostya Serebryany <kcc@google.com>2017-11-15 16:42:52 +0000
commit8eb9ca25808742fffa61413cdf3ce26dd8c0704e (patch)
treeb86d5949c07dd3e17f1dc083f9339e795b743d38 /compiler-rt
parent58f2656d7e1d98030ef04229f7f55187cb1fb286 (diff)
downloadbcm5719-llvm-8eb9ca25808742fffa61413cdf3ce26dd8c0704e.tar.gz
bcm5719-llvm-8eb9ca25808742fffa61413cdf3ce26dd8c0704e.zip
[libFuzzer] respect max_len during merge
llvm-svn: 318302
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/fuzzer/FuzzerMerge.cpp2
-rw-r--r--compiler-rt/test/fuzzer/merge.test4
2 files changed, 5 insertions, 1 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerMerge.cpp b/compiler-rt/lib/fuzzer/FuzzerMerge.cpp
index 9b21a0917fb..934871b15f5 100644
--- a/compiler-rt/lib/fuzzer/FuzzerMerge.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerMerge.cpp
@@ -379,7 +379,7 @@ void Fuzzer::CrashResistantMerge(const Vector<std::string> &Args,
Printf("MERGE-OUTER: %zd new files with %zd new features added\n",
NewFiles.size(), NumNewFeatures);
for (auto &F: NewFiles)
- WriteToOutputCorpus(FileToVector(F));
+ WriteToOutputCorpus(FileToVector(F, MaxInputLen));
// We are done, delete the control file if it was a temporary one.
if (!MergeControlFilePathOrNull)
RemoveFile(CFPath);
diff --git a/compiler-rt/test/fuzzer/merge.test b/compiler-rt/test/fuzzer/merge.test
index 262f26e5b02..d77a4473bbf 100644
--- a/compiler-rt/test/fuzzer/merge.test
+++ b/compiler-rt/test/fuzzer/merge.test
@@ -58,7 +58,11 @@ MERGE_WITH_CRASH: MERGE-OUTER: succesfull in 2 attempt(s)
MERGE_WITH_CRASH: MERGE-OUTER: 3 new files
# Check that we actually limit the size with max_len
+RUN: rm %t/T1/*
+RUN: echo 'FUZZER' > %t/T2/FUZZER
RUN: %t-FullCoverageSetTest -merge=1 %t/T1 %t/T2 -max_len=5 2>&1 | FileCheck %s --check-prefix=MERGE_LEN5
+RUN: not grep FUZZER %t/T1/*
+RUN: grep FUZZE %t/T1/*
MERGE_LEN5: MERGE-OUTER: succesfull in 1 attempt(s)
RUN: rm -rf %t/T1/* %t/T2/*
OpenPOWER on IntegriCloud