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

Method next_range

hail-fuzz/src/i2s/colorization.rs:51–80  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

49
50impl ColorizationStage {
51 fn next_range(&mut self) -> Option<Range> {
52 let current_stream_range = (|| {
53 let next = self.ranges.pop()?.0;
54 self.attempts = match self.attempts.checked_sub(1) {
55 Some(attempts) => attempts,
56 None => {
57 tracing::debug!(
58 "exceeded max colorization attempts for {:#x} ({} ranges remaining)",
59 next.stream,
60 self.ranges.len()
61 );
62 return None;
63 }
64 };
65 Some(next)
66 })();
67
68 if let Some(range) = current_stream_range {
69 return Some(range);
70 }
71
72 self.ranges.clear();
73
74 let (stream, max_len) = self.remaining_streams.pop()?;
75 let len = self.mutated_input.streams[&stream].bytes.len() as u32;
76
77 self.attempts = (len as usize * 2).min(max_len as usize * 2);
78
79 Some(Range { stream, start: len.saturating_sub(max_len), end: len })
80 }
81
82 pub fn start(fuzzer: &mut Fuzzer) -> Result<Self, StageExit>
83 where

Callers 1

fuzz_oneMethod · 0.80

Calls 2

clearMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected