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

Method end

hail-fuzz/src/i2s/colorization.rs:187–218  ·  view source on GitHub ↗
(&mut self, fuzzer: &mut Fuzzer)

Source from the content-addressed store, hash-verified

185 }
186
187 fn end(&mut self, fuzzer: &mut Fuzzer) {
188 if fuzzer.debug.cmplog && fuzzer.global.is_main_instance() {
189 let _ = std::fs::write(
190 &fuzzer.workdir.join(&format!("queue/{}.colorized.bin", self.input_id)),
191 &fuzzer.state.input.to_bytes(),
192 );
193 }
194
195 let mut total_colorized = 0;
196 let mut total_attempted = 0;
197 let max_len = fuzzer.features.max_i2s_bytes;
198 for (&addr, &count) in &self.colorized_bytes {
199 let attempted = fuzzer.state.input.streams[&addr].bytes.len().min(max_len);
200
201 let metadata = fuzzer.corpus.metadata.streams.entry(addr).or_default();
202 metadata.colorized_bytes.0 += count;
203 metadata.colorized_bytes.1 += attempted;
204
205 total_colorized += count;
206 total_attempted += attempted;
207 }
208 fuzzer.corpus[self.input_id]
209 .stage_data
210 .insert(Stage::Colorization, Box::new(self.colorized_bytes.clone()));
211
212 tracing::debug!(
213 "{total_colorized} of {} bytes colorized ({:.2}%) in {} attempts",
214 fuzzer.state.input.total_bytes(),
215 (total_colorized as f64 / total_attempted as f64) * 100.0,
216 self.total_execs,
217 )
218 }
219}
220
221#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)]

Callers 1

runMethod · 0.45

Calls 4

is_main_instanceMethod · 0.80
to_bytesMethod · 0.80
cloneMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected