[PATCH] D60567: [libFuzzer] Fallback to default Mutate when MutateWithMask fails.

Max Moroz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 11 09:24:09 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT358190: [libFuzzer] Fallback to default Mutate when MutateWithMask fails. (authored by Dor1s, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D60567?vs=194698&id=194709#toc

Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60567/new/

https://reviews.llvm.org/D60567

Files:
  lib/fuzzer/FuzzerLoop.cpp
  lib/fuzzer/FuzzerMutate.cpp


Index: lib/fuzzer/FuzzerLoop.cpp
===================================================================
--- lib/fuzzer/FuzzerLoop.cpp
+++ lib/fuzzer/FuzzerLoop.cpp
@@ -658,7 +658,9 @@
         Size <= CurrentMaxMutationLen)
       NewSize = MD.MutateWithMask(CurrentUnitData, Size, Size,
                                   II.DataFlowTraceForFocusFunction);
-    else
+    
+    // If MutateWithMask either failed or wasn't called, call default Mutate.
+    if (!NewSize)
       NewSize = MD.Mutate(CurrentUnitData, Size, CurrentMaxMutationLen);
     assert(NewSize > 0 && "Mutator returned empty unit");
     assert(NewSize <= CurrentMaxMutationLen && "Mutator return oversized unit");
Index: lib/fuzzer/FuzzerMutate.cpp
===================================================================
--- lib/fuzzer/FuzzerMutate.cpp
+++ lib/fuzzer/FuzzerMutate.cpp
@@ -542,6 +542,7 @@
     if (Mask[I])
       T[OneBits++] = Data[I];
 
+  if (!OneBits) return 0;
   assert(!T.empty());
   size_t NewSize = Mutate(T.data(), OneBits, OneBits);
   assert(NewSize <= OneBits);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60567.194709.patch
Type: text/x-patch
Size: 1059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190411/e6f9d590/attachment.bin>


More information about the llvm-commits mailing list