compile the huge fuzzers with libfuzzer.
(&self)
| 382 | |
| 383 | /// compile the huge fuzzers with libfuzzer. |
| 384 | pub fn compile(&self) -> Result<()> { |
| 385 | let executor = Executor::new(&self.deopt)?; |
| 386 | for dir in std::fs::read_dir(self.deopt.get_library_fuzzer_dir(self.use_constraint)?)? { |
| 387 | let fuzzer_dir = dir?.path(); |
| 388 | if fuzzer_dir.is_dir() { |
| 389 | log::info!("Compile to Fuzzer: {fuzzer_dir:?}"); |
| 390 | for entry in std::fs::read_dir(&fuzzer_dir)? { |
| 391 | let path = entry?.path(); |
| 392 | if path.is_file() |
| 393 | && path.extension().is_some() |
| 394 | && path.extension().unwrap().to_string_lossy() == "cc" |
| 395 | { |
| 396 | fix_driver_naming_conflict(&path)?; |
| 397 | } |
| 398 | } |
| 399 | let fuzzer_binary = get_fuzzer_path(&fuzzer_dir); |
| 400 | executor.compile_lib_fuzzers( |
| 401 | &fuzzer_dir, |
| 402 | &fuzzer_binary, |
| 403 | crate::execution::Compile::FUZZER, |
| 404 | )?; |
| 405 | let fuzzer_sancov = fuzzer_binary.with_extension("sancov"); |
| 406 | executor.compile_lib_fuzzers( |
| 407 | &fuzzer_dir, |
| 408 | &fuzzer_sancov, |
| 409 | crate::execution::Compile::Minimize, |
| 410 | )?; |
| 411 | self.deopt.copy_library_init_file(&fuzzer_dir)?; |
| 412 | } |
| 413 | } |
| 414 | Ok(()) |
| 415 | } |
| 416 | |
| 417 | fn get_minimized_corpus(&self, driver: &Path) -> Result<PathBuf> { |
| 418 | let program = Program::load_from_path(driver)?; |