MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / recheck_seed

Method recheck_seed

src/execution/sanitize.rs:284–309  ·  view source on GitHub ↗

After the first half of converge, performs sanitization on the seeds again. It aims to: Sanitize the erroneous programs that were ignored due to no suitable fuzzing corpus to trigger the error.

(&mut self, deopt: &mut Deopt)

Source from the content-addressed store, hash-verified

282 /// After the first half of converge, performs sanitization on the seeds again. It aims to:
283 /// Sanitize the erroneous programs that were ignored due to no suitable fuzzing corpus to trigger the error.
284 pub fn recheck_seed(&mut self, deopt: &mut Deopt) -> Result<()> {
285 log::info!("Recheck the saved seeds and remove the error programs within them.");
286 let succ_seed_dir = self.deopt.get_library_succ_seed_dir()?;
287 let succ_seeds = crate::deopt::utils::read_sort_dir(&succ_seed_dir)?;
288 for succ_seed in &succ_seeds {
289 let seed_program = Program::load_from_path(succ_seed)?;
290 let seed_id = seed_program.id;
291 self.compile_seed(seed_id)?;
292 // recheck the program
293 let corpus = self.deopt.get_library_shared_corpus_dir()?;
294 let work_seed_path = self.deopt.get_work_seed_by_id(seed_id)?;
295 let binary_out = work_seed_path.with_extension("out");
296 let has_err = self.execute_pool(&binary_out, &corpus);
297 if let Some(err_msg) = has_err {
298 log::warn!("seed: {} is rechecked as Error!", seed_id);
299 let seed = self.deopt.get_seed_path_by_id(seed_id)?;
300 self.deopt.save_err_program(&seed_program, &err_msg)?;
301 std::fs::remove_file(succ_seed)?;
302 if seed.exists() {
303 std::fs::remove_file(seed)?;
304 deopt.delete_seed_from_queue(&seed_program);
305 }
306 }
307 }
308 Ok(())
309 }
310}
311
312pub mod utils {

Callers 2

fuzz_loopMethod · 0.80
recheckFunction · 0.80

Calls 9

read_sort_dirFunction · 0.85
compile_seedMethod · 0.80
get_work_seed_by_idMethod · 0.80
execute_poolMethod · 0.80
get_seed_path_by_idMethod · 0.80
save_err_programMethod · 0.80

Tested by

no test coverage detected