size_t MaxSize) {
if (!Corpus || Corpus->size() < 2 || Size == 0)
return 0;
- size_t Idx = Corpus->ChooseUnitIdxToMutate(Rand);
+ size_t Idx = Rand(Corpus->size());
const Unit &Other = (*Corpus)[Idx];
if (Other.empty())
return 0;
void ClearAutoDictionary();
void PrintRecommendedDictionary();
- void SetCorpus(InputCorpus *Corpus) { this->Corpus = Corpus; }
+ void SetCorpus(const InputCorpus *Corpus) { this->Corpus = Corpus; }
Random &GetRand() { return Rand; }
DictionaryEntry CmpDictionaryEntriesDeque[kCmpDictionaryEntriesDequeSize];
size_t CmpDictionaryEntriesDequeIdx = 0;
- InputCorpus *Corpus = nullptr;
+ const 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.