diff options
| author | Kostya Serebryany <kcc@google.com> | 2018-07-19 01:23:32 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2018-07-19 01:23:32 +0000 |
| commit | 6b87e0c18f049172b33144f561cf4baa8b225d8d (patch) | |
| tree | 8a0bed57646b09b3f2eaf016b5095e9c0f12364c /compiler-rt/lib/fuzzer/FuzzerLoop.cpp | |
| parent | da08f6ac16b6a53ab25ecb56e1be800c5f0095d9 (diff) | |
| download | bcm5719-llvm-6b87e0c18f049172b33144f561cf4baa8b225d8d.tar.gz bcm5719-llvm-6b87e0c18f049172b33144f561cf4baa8b225d8d.zip | |
[libFuzzer] first experimental attempt at DFT-based mutations (DFT=data-flow-trace)
llvm-svn: 337434
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerLoop.cpp')
| -rw-r--r-- | compiler-rt/lib/fuzzer/FuzzerLoop.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerLoop.cpp b/compiler-rt/lib/fuzzer/FuzzerLoop.cpp index 1ba0765fab9..ffcd3419c6c 100644 --- a/compiler-rt/lib/fuzzer/FuzzerLoop.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerLoop.cpp @@ -503,8 +503,7 @@ bool Fuzzer::RunOne(const uint8_t *Data, size_t Size, bool MayDeleteFile, if (NumNewFeatures) { TPC.UpdateObservedPCs(); Corpus.AddToCorpus({Data, Data + Size}, NumNewFeatures, MayDeleteFile, - TPC.ObservedFocusFunction(), - UniqFeatureSetTmp, DFT); + TPC.ObservedFocusFunction(), UniqFeatureSetTmp, DFT, II); return true; } if (II && FoundUniqFeaturesOfII && @@ -687,7 +686,12 @@ void Fuzzer::MutateAndTestOne() { break; MaybeExitGracefully(); size_t NewSize = 0; - NewSize = MD.Mutate(CurrentUnitData, Size, CurrentMaxMutationLen); + if (II.HasFocusFunction && !II.DataFlowTraceForFocusFunction.empty() && + Size <= CurrentMaxMutationLen) + NewSize = MD.MutateWithMask(CurrentUnitData, Size, Size, + II.DataFlowTraceForFocusFunction); + else + NewSize = MD.Mutate(CurrentUnitData, Size, CurrentMaxMutationLen); assert(NewSize > 0 && "Mutator returned empty unit"); assert(NewSize <= CurrentMaxMutationLen && "Mutator return oversized unit"); Size = NewSize; |

