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

Method start

hail-fuzz/src/extension.rs:53–107  ·  view source on GitHub ↗
(fuzzer: &mut Fuzzer)

Source from the content-addressed store, hash-verified

51
52impl MultiStreamExtendStage {
53 fn start(fuzzer: &mut Fuzzer) -> Result<Self, StageExit> {
54 fuzzer.copy_current_input();
55
56 let mut attempts = calculate_energy(fuzzer) as usize;
57
58 let last_read = Self::crate_snapshot_after(fuzzer, 0)?;
59 let mut end_addrs = HashSet::new();
60 end_addrs.insert(fuzzer.vm.cpu.read_pc());
61
62 let mut streams_to_mutate = hashbrown::HashMap::new();
63
64 let factor = fuzzer.get_extension_factor(last_read);
65 streams_to_mutate.insert(last_read, factor);
66
67 // @todo: consider adjusting the energy for inputs with a long initial execution time,
68 // reducing the amount of times this input is scheduled proportionally.
69
70 let log2_max_extensions = log2_max_extensions(fuzzer);
71 let extension_limit = extension_limit(fuzzer);
72
73 let is_first_attempt = fuzzer
74 .input_id
75 .map(|id| fuzzer.corpus[id].metadata.length_extension_rounds == 0)
76 .unwrap_or(true);
77 if is_first_attempt {
78 attempts *= config::INCREASE_EXTENSIONS_ON_FIRST_EXEC_FACTOR;
79 }
80
81 tracing::debug!(
82 "[{}] {last_read:#x}@{:#x} (factor={factor}, max extensions={}, limit={extension_limit}) len={}, attempts={attempts}, icount={}",
83 fuzzer.input_id.unwrap_or(0),
84 fuzzer.vm.cpu.read_pc(),
85 2_u32.pow(log2_max_extensions),
86 fuzzer.state.input.total_bytes(),
87 fuzzer.state.instructions,
88 );
89 if let Some(id) = fuzzer.input_id {
90 fuzzer.corpus[id].metadata.length_extension_rounds += 1;
91 }
92
93 Ok(Self {
94 current_input: fuzzer.state.input.clone(),
95 local_depth: 1,
96 log2_max_extensions,
97 extension_limit,
98 new_starting_inputs: VecDeque::new(),
99 rare_input: None,
100 i2s_data: None,
101 i2s_replacement_attempts: 0,
102 end_addrs,
103 streams_to_mutate,
104 energy: attempts,
105 attempts,
106 })
107 }
108
109 fn exec_one(&mut self, fuzzer: &mut Fuzzer) -> Option<VmExit> {
110 Snapshot::restore_prefix(fuzzer);

Callers

nothing calls this directly

Calls 6

calculate_energyFunction · 0.85
log2_max_extensionsFunction · 0.85
extension_limitFunction · 0.85
copy_current_inputMethod · 0.80
get_extension_factorMethod · 0.80
cloneMethod · 0.80

Tested by

no test coverage detected