[compiler-rt] r318302 - [libFuzzer] respect max_len during merge

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 08:42:52 PST 2017


Author: kcc
Date: Wed Nov 15 08:42:52 2017
New Revision: 318302

URL: http://llvm.org/viewvc/llvm-project?rev=318302&view=rev
Log:
[libFuzzer] respect max_len during merge

Modified:
    compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp
    compiler-rt/trunk/test/fuzzer/merge.test

Modified: compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp?rev=318302&r1=318301&r2=318302&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp Wed Nov 15 08:42:52 2017
@@ -379,7 +379,7 @@ void Fuzzer::CrashResistantMerge(const V
   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);

Modified: compiler-rt/trunk/test/fuzzer/merge.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/merge.test?rev=318302&r1=318301&r2=318302&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/merge.test (original)
+++ compiler-rt/trunk/test/fuzzer/merge.test Wed Nov 15 08:42:52 2017
@@ -58,7 +58,11 @@ MERGE_WITH_CRASH: MERGE-OUTER: succesful
 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/*




More information about the llvm-commits mailing list