Lines Matching full:size
70 size_t MutationDispatcher::Mutate_Custom(uint8_t *Data, size_t Size, in Mutate_Custom() argument
72 return EF->LLVMFuzzerCustomMutator(Data, Size, MaxSize, Rand.Rand()); in Mutate_Custom()
75 size_t MutationDispatcher::Mutate_CustomCrossOver(uint8_t *Data, size_t Size, in Mutate_CustomCrossOver() argument
77 if (!Corpus || Corpus->size() < 2 || Size == 0) in Mutate_CustomCrossOver()
79 size_t Idx = Rand(Corpus->size()); in Mutate_CustomCrossOver()
86 Data, Size, Other.data(), Other.size(), U.data(), U.size(), Rand.Rand()); in Mutate_CustomCrossOver()
94 size_t MutationDispatcher::Mutate_ShuffleBytes(uint8_t *Data, size_t Size, in Mutate_ShuffleBytes() argument
96 assert(Size); in Mutate_ShuffleBytes()
98 Rand(std::min(Size, (size_t)8)) + 1; // [1,8] and <= Size. in Mutate_ShuffleBytes()
99 size_t ShuffleStart = Rand(Size - ShuffleAmount); in Mutate_ShuffleBytes()
100 assert(ShuffleStart + ShuffleAmount <= Size); in Mutate_ShuffleBytes()
103 return Size; in Mutate_ShuffleBytes()
106 size_t MutationDispatcher::Mutate_EraseByte(uint8_t *Data, size_t Size, in Mutate_EraseByte() argument
108 assert(Size); in Mutate_EraseByte()
109 if (Size == 1) return 0; in Mutate_EraseByte()
110 size_t Idx = Rand(Size); in Mutate_EraseByte()
112 memmove(Data + Idx, Data + Idx + 1, Size - Idx - 1); in Mutate_EraseByte()
113 return Size - 1; in Mutate_EraseByte()
116 size_t MutationDispatcher::Mutate_InsertByte(uint8_t *Data, size_t Size, in Mutate_InsertByte() argument
118 if (Size == MaxSize) return 0; in Mutate_InsertByte()
119 size_t Idx = Rand(Size + 1); in Mutate_InsertByte()
121 memmove(Data + Idx + 1, Data + Idx, Size - Idx); in Mutate_InsertByte()
123 return Size + 1; in Mutate_InsertByte()
126 size_t MutationDispatcher::Mutate_ChangeByte(uint8_t *Data, size_t Size, in Mutate_ChangeByte() argument
128 size_t Idx = Rand(Size); in Mutate_ChangeByte()
130 return Size; in Mutate_ChangeByte()
133 size_t MutationDispatcher::Mutate_ChangeBit(uint8_t *Data, size_t Size, in Mutate_ChangeBit() argument
135 size_t Idx = Rand(Size); in Mutate_ChangeBit()
137 return Size; in Mutate_ChangeBit()
141 size_t Size, in Mutate_AddWordFromManualDictionary() argument
143 return AddWordFromDictionary(ManualDictionary, Data, Size, MaxSize); in Mutate_AddWordFromManualDictionary()
147 uint8_t *Data, size_t Size, size_t MaxSize) { in Mutate_AddWordFromTemporaryAutoDictionary() argument
148 return AddWordFromDictionary(TempAutoDictionary, Data, Size, MaxSize); in Mutate_AddWordFromTemporaryAutoDictionary()
152 uint8_t *Data, size_t Size, size_t MaxSize) { in Mutate_AddWordFromPersistentAutoDictionary() argument
153 return AddWordFromDictionary(PersistentAutoDictionary, Data, Size, MaxSize); in Mutate_AddWordFromPersistentAutoDictionary()
157 size_t Size, size_t MaxSize) { in AddWordFromDictionary() argument
159 DictionaryEntry &DE = D[Rand(D.size())]; in AddWordFromDictionary()
162 DE.GetPositionHint() + W.size() < Size && Rand.RandBool(); in AddWordFromDictionary()
164 if (Size + W.size() > MaxSize) return 0; in AddWordFromDictionary()
165 size_t Idx = UsePositionHint ? DE.GetPositionHint() : Rand(Size + 1); in AddWordFromDictionary()
166 memmove(Data + Idx + W.size(), Data + Idx, Size - Idx); in AddWordFromDictionary()
167 memcpy(Data + Idx, W.data(), W.size()); in AddWordFromDictionary()
168 Size += W.size(); in AddWordFromDictionary()
170 if (W.size() > Size) return 0; in AddWordFromDictionary()
171 size_t Idx = UsePositionHint ? DE.GetPositionHint() : Rand(Size - W.size()); in AddWordFromDictionary()
172 memcpy(Data + Idx, W.data(), W.size()); in AddWordFromDictionary()
176 return Size; in AddWordFromDictionary()
179 size_t MutationDispatcher::Mutate_ChangeASCIIInteger(uint8_t *Data, size_t Size, in Mutate_ChangeASCIIInteger() argument
181 size_t B = Rand(Size); in Mutate_ChangeASCIIInteger()
182 while (B < Size && !isdigit(Data[B])) B++; in Mutate_ChangeASCIIInteger()
183 if (B == Size) return 0; in Mutate_ChangeASCIIInteger()
185 while (E < Size && isdigit(Data[E])) E++; in Mutate_ChangeASCIIInteger()
209 return Size; in Mutate_ChangeASCIIInteger()
212 size_t MutationDispatcher::Mutate_CrossOver(uint8_t *Data, size_t Size, in Mutate_CrossOver() argument
214 if (!Corpus || Corpus->size() < 2 || Size == 0) return 0; in Mutate_CrossOver()
215 size_t Idx = Rand(Corpus->size()); in Mutate_CrossOver()
221 CrossOver(Data, Size, Other.data(), Other.size(), U.data(), U.size()); in Mutate_CrossOver()
260 Printf("MS: %zd ", CurrentMutatorSequence.size()); in PrintMutationSequence()
272 size_t MutationDispatcher::Mutate(uint8_t *Data, size_t Size, size_t MaxSize) { in Mutate() argument
273 return MutateImpl(Data, Size, MaxSize, Mutators); in Mutate()
276 size_t MutationDispatcher::DefaultMutate(uint8_t *Data, size_t Size, in DefaultMutate() argument
278 return MutateImpl(Data, Size, MaxSize, DefaultMutators); in DefaultMutate()
281 // Mutates Data in place, returns new size.
282 size_t MutationDispatcher::MutateImpl(uint8_t *Data, size_t Size, in MutateImpl() argument
286 assert(Size <= MaxSize); in MutateImpl()
287 if (Size == 0) { in MutateImpl()
294 assert(Size > 0); in MutateImpl()
295 // Some mutations may fail (e.g. can't insert more bytes if Size == MaxSize), in MutateImpl()
299 auto M = Mutators[Rand(Mutators.size())]; in MutateImpl()
300 size_t NewSize = (this->*(M.Fn))(Data, Size, MaxSize); in MutateImpl()
308 return Size; in MutateImpl()
319 if (TempAutoDictionary.size() >= kMaxAutoDictSize) return; in AddWordToAutoDictionary()