[llvm] r297891 - [libFuzzer] Use ChooseUnitIdxToMutate to pick item for crossover.
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 15 13:59:27 PDT 2017
Author: vitalybuka
Date: Wed Mar 15 15:59:27 2017
New Revision: 297891
URL: http://llvm.org/viewvc/llvm-project?rev=297891&view=rev
Log:
[libFuzzer] Use ChooseUnitIdxToMutate to pick item for crossover.
Differential Revision: https://reviews.llvm.org/D30683
Modified:
llvm/trunk/lib/Fuzzer/FuzzerMutate.cpp
llvm/trunk/lib/Fuzzer/FuzzerMutate.h
Modified: llvm/trunk/lib/Fuzzer/FuzzerMutate.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerMutate.cpp?rev=297891&r1=297890&r2=297891&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerMutate.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerMutate.cpp Wed Mar 15 15:59:27 2017
@@ -77,7 +77,7 @@ size_t MutationDispatcher::Mutate_Custom
size_t MaxSize) {
if (!Corpus || Corpus->size() < 2 || Size == 0)
return 0;
- size_t Idx = Rand(Corpus->size());
+ size_t Idx = Corpus->ChooseUnitIdxToMutate(Rand);
const Unit &Other = (*Corpus)[Idx];
if (Other.empty())
return 0;
Modified: llvm/trunk/lib/Fuzzer/FuzzerMutate.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerMutate.h?rev=297891&r1=297890&r2=297891&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerMutate.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerMutate.h Wed Mar 15 15:59:27 2017
@@ -88,7 +88,7 @@ public:
void ClearAutoDictionary();
void PrintRecommendedDictionary();
- void SetCorpus(const InputCorpus *Corpus) { this->Corpus = Corpus; }
+ void SetCorpus(InputCorpus *Corpus) { this->Corpus = Corpus; }
Random &GetRand() { return Rand; }
@@ -141,7 +141,7 @@ private:
DictionaryEntry CmpDictionaryEntriesDeque[kCmpDictionaryEntriesDequeSize];
size_t CmpDictionaryEntriesDequeIdx = 0;
- const InputCorpus *Corpus = nullptr;
+ InputCorpus *Corpus = nullptr;
std::vector<uint8_t> MutateInPlaceHere;
// CustomCrossOver needs its own buffer as a custom implementation may call
// LLVMFuzzerMutate, which in turn may resize MutateInPlaceHere.
More information about the llvm-commits
mailing list