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

Method start

hail-fuzz/src/havoc.rs:30–66  ·  view source on GitHub ↗
(fuzzer: &mut Fuzzer)

Source from the content-addressed store, hash-verified

28
29impl StageData for HavocStage {
30 fn start(fuzzer: &mut Fuzzer) -> Result<Self, StageExit> {
31 fuzzer.copy_current_input();
32
33 let (Some(id), data) = (fuzzer.input_id, &fuzzer.state.input)
34 else {
35 return Err(StageExit::Unsupported);
36 };
37
38 let streams = get_non_empty_streams(data);
39 if streams.is_empty() {
40 // Must have at least one non-empty stream.
41 return Err(StageExit::Skip);
42 }
43
44 let stream_distr = get_stream_weights(fuzzer, id, &streams);
45 let mutator = HavocMutator::new();
46 let attempts = calculate_energy(fuzzer) as u32;
47 let log2_max_mutations = log2_max_mutations(fuzzer);
48 let max_mutations = max_mutations(fuzzer);
49
50 fuzzer.corpus[id].metadata.havoc_rounds += 1;
51
52 tracing::trace!(
53 "[{id}] havoc for {attempts} attempts with {} max mutations",
54 2_u64.pow(log2_max_mutations)
55 );
56 Ok(Self {
57 attempts,
58 streams,
59 stream_distr,
60 mutator,
61 log2_max_mutations,
62 max_mutations,
63 streams_to_extend: HashMap::new(),
64 saved: false,
65 })
66 }
67
68 fn fuzz_one(&mut self, fuzzer: &mut Fuzzer) -> Option<VmExit> {
69 self.attempts = self.attempts.checked_sub(1)?;

Callers

nothing calls this directly

Calls 7

get_non_empty_streamsFunction · 0.85
get_stream_weightsFunction · 0.85
calculate_energyFunction · 0.85
log2_max_mutationsFunction · 0.85
max_mutationsFunction · 0.85
copy_current_inputMethod · 0.80
is_emptyMethod · 0.80

Tested by

no test coverage detected