about summary refs log tree commit diff
path: root/custom_mutators/libfuzzer/FuzzerMutate.cpp
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-09-21 15:47:10 +0200
committervan Hauser <vh@thc.org>2020-09-21 15:47:10 +0200
commit207cbd5cf7c1956969f42e89bfcb9a0ab451e351 (patch)
treea66af166a8c5ea07adc570b28d68ed53433876dc /custom_mutators/libfuzzer/FuzzerMutate.cpp
parentf34fe1f81e804bccdda5315968f6a73a47184822 (diff)
downloadafl++-207cbd5cf7c1956969f42e89bfcb9a0ab451e351.tar.gz
fix and update libfuzzer custom mutator
Diffstat (limited to 'custom_mutators/libfuzzer/FuzzerMutate.cpp')
-rw-r--r--custom_mutators/libfuzzer/FuzzerMutate.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/custom_mutators/libfuzzer/FuzzerMutate.cpp b/custom_mutators/libfuzzer/FuzzerMutate.cpp
index 8faf6918..eebae39b 100644
--- a/custom_mutators/libfuzzer/FuzzerMutate.cpp
+++ b/custom_mutators/libfuzzer/FuzzerMutate.cpp
@@ -17,7 +17,8 @@
 
 namespace fuzzer {
 
-const size_t Dictionary::kMaxDictSize;
+const size_t        Dictionary::kMaxDictSize;
+static const size_t kMaxMutationsToPrint = 10;
 
 static void PrintASCII(const Word &W, const char *PrintAfter) {
 
@@ -608,18 +609,24 @@ void MutationDispatcher::PrintRecommendedDictionary() {
 
 }
 
-void MutationDispatcher::PrintMutationSequence() {
+void MutationDispatcher::PrintMutationSequence(bool Verbose) {
 
   Printf("MS: %zd ", CurrentMutatorSequence.size());
-  for (auto M : CurrentMutatorSequence)
-    Printf("%s-", M.Name);
+  size_t EntriesToPrint =
+      Verbose ? CurrentMutatorSequence.size()
+              : std::min(kMaxMutationsToPrint, CurrentMutatorSequence.size());
+  for (size_t i = 0; i < EntriesToPrint; i++)
+    Printf("%s-", CurrentMutatorSequence[i].Name);
   if (!CurrentDictionaryEntrySequence.empty()) {
 
     Printf(" DE: ");
-    for (auto DE : CurrentDictionaryEntrySequence) {
+    EntriesToPrint = Verbose ? CurrentDictionaryEntrySequence.size()
+                             : std::min(kMaxMutationsToPrint,
+                                        CurrentDictionaryEntrySequence.size());
+    for (size_t i = 0; i < EntriesToPrint; i++) {
 
       Printf("\"");
-      PrintASCII(DE->GetW(), "\"-");
+      PrintASCII(CurrentDictionaryEntrySequence[i]->GetW(), "\"-");
 
     }