(fuzzer_entry: &Path, executor: &Executor)
| 800 | } |
| 801 | |
| 802 | fn sanitize_ubsan_report(fuzzer_entry: &Path, executor: &Executor) -> Result<Vec<String>> { |
| 803 | let fuzzer = get_fuzzer_path(fuzzer_entry); |
| 804 | let mut corpus = fuzzer_entry.to_path_buf(); |
| 805 | corpus.push("minimized_corpus"); |
| 806 | let mut ubsan_crashes = Vec::new(); |
| 807 | |
| 808 | let corpora_files = read_sort_dir(&corpus)?; |
| 809 | for corpora in corpora_files { |
| 810 | log::info!("test UBSan on corpora: {corpora:?}"); |
| 811 | let extra_args = vec![corpora.as_os_str()]; |
| 812 | let extra_envs = vec![( |
| 813 | OsStr::new("UBSAN_OPTIONS"), |
| 814 | OsStr::new("symbolize=1:print_stacktrace=1:halt_on_error=1"), |
| 815 | )]; |
| 816 | let child = executor.spawn(&fuzzer, extra_args, extra_envs, None, None, true); |
| 817 | let output = child.wait_with_output()?; |
| 818 | if output.status.success() { |
| 819 | continue; |
| 820 | } |
| 821 | let err_msg = String::from_utf8_lossy(&output.stderr); |
| 822 | if let Some(crash_point) = get_ubsan_crash_point(&err_msg) { |
| 823 | if ubsan_crashes.contains(&crash_point) { |
| 824 | continue; |
| 825 | } |
| 826 | ubsan_crashes.push(crash_point); |
| 827 | save_ubsan_report(fuzzer_entry, ubsan_crashes.len(), &corpora, &err_msg)?; |
| 828 | } |
| 829 | } |
| 830 | Ok(ubsan_crashes) |
| 831 | } |
| 832 | |
| 833 | fn parse_call_stack_line(line: &str) -> Result<(String, String)> { |
| 834 | let mut de = Deserializer::from_input(line); |
no test coverage detected