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

Method is_program_execute_correct

src/execution/sanitize.rs:58–77  ·  view source on GitHub ↗

linked with AddressSanitizer, execute it to check whether code is correct.

(&self, program_path: &Path)

Source from the content-addressed store, hash-verified

56
57 /// linked with AddressSanitizer, execute it to check whether code is correct.
58 fn is_program_execute_correct(&self, program_path: &Path) -> Result<Option<ProgramError>> {
59 let time_logger = TimeUsage::new(get_file_dirname(program_path));
60 let mut transformer = Transformer::new(program_path, &self.deopt)?;
61 transformer.add_fd_sanitizer()?;
62 transformer.preprocess()?;
63
64 let mut binary_out = PathBuf::from(program_path);
65 binary_out.set_extension("out");
66
67 self.deopt
68 .copy_library_init_file(&get_file_dirname(program_path))?;
69
70 self.compile(vec![program_path], &binary_out, super::Compile::FUZZER)?;
71
72 // Execute the program on each corpus file and check error.
73 let corpus = self.deopt.get_library_shared_corpus_dir()?;
74 let has_err = self.execute_pool(&binary_out, &corpus);
75 time_logger.log("execute")?;
76 Ok(has_err)
77 }
78
79 /// linked with LibFuzzer and AddressSanitizer, to check whether code is correct.
80 pub fn is_program_fuzz_correct(&self, program_path: &Path) -> Result<Option<ProgramError>> {

Callers 1

Calls 8

get_file_dirnameFunction · 0.85
add_fd_sanitizerMethod · 0.80
preprocessMethod · 0.80
execute_poolMethod · 0.80
logMethod · 0.80
compileMethod · 0.45

Tested by

no test coverage detected