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

Function sanitize_crash_by_call_stack

src/program/libfuzzer.rs:885–908  ·  view source on GitHub ↗
(crashes: Vec<PathBuf>)

Source from the content-addressed store, hash-verified

883 }
884
885 fn sanitize_crash_by_call_stack(crashes: Vec<PathBuf>) -> Result<Vec<PathBuf>> {
886 log::info!("Sanitze those crashes by call stacks");
887 let mut unique_crashes = Vec::new();
888 let mut sig_set: HashSet<String> = HashSet::new();
889 for crash_dir in crashes {
890 let call_stack = parse_call_stack_from_err_msg(&crash_dir)
891 .context(format!("parse error happened in : {crash_dir:?}"));
892 if let Err(err) = call_stack {
893 log::error!("{crash_dir:?} doesn't contains the valid call stack, please sanitize it manually.\n {err:?}");
894 unique_crashes.push(crash_dir);
895 continue;
896 }
897 let sig = call_stack_to_hash(call_stack?);
898 if sig_set.contains(&sig) {
899 log::debug!("{crash_dir:?} is sanitized due bo dupliciated call stack.");
900 std::fs::remove_dir_all(crash_dir)?;
901 continue;
902 }
903 unique_crashes.push(crash_dir);
904 sig_set.insert(sig);
905 }
906
907 Ok(unique_crashes)
908 }
909}
910
911#[cfg(test)]

Callers 1

sanitize_crashFunction · 0.85

Calls 3

call_stack_to_hashFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected