MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / hit_replacement_limit

Method hit_replacement_limit

hail-fuzz/src/i2s/replacement.rs:309–326  ·  view source on GitHub ↗

Checks if we have hit the replacement limit for the current stream/comparison.

(&mut self, dst: &[u8])

Source from the content-addressed store, hash-verified

307
308 /// Checks if we have hit the replacement limit for the current stream/comparison.
309 fn hit_replacement_limit(&mut self, dst: &[u8]) -> bool {
310 if self.cursor.finder.replacement.len() > 1 {
311 // Multi-byte replacements are sufficiently rare that we can try all of them.
312 return false;
313 }
314
315 let matching_value = get_u64(self.cursor.finder.get_value_to_replace(dst));
316 let tried_match = self.tried_matches.entry(matching_value).or_default();
317 let replacement = get_u64(&self.cursor.finder.replacement);
318 let tried_replacement = self.tried_replacements.entry(replacement).or_default();
319
320 if *tried_match > MAX_ONE_BYTE_MATCHES || *tried_replacement > MAX_ONE_BYTE_REPLACEMENTS {
321 return true;
322 }
323 *tried_match += 1;
324 *tried_replacement += 1;
325 false
326 }
327
328 fn try_exec(
329 &mut self,

Callers 1

next_replacementMethod · 0.80

Calls 2

get_value_to_replaceMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected