Skip to content

Commit

Permalink
Call existing panic hook before aborting
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Dec 4, 2023
1 parent 8925666 commit 2bbd3d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion afl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ where
// unsafe { asm!("" : : "r"(&DEFERED_MARKER)) };

if hook {
let prev_hook = std::panic::take_hook();
// sets panic hook to abort
std::panic::set_hook(Box::new(|_| {
std::panic::set_hook(Box::new(move |panic_info| {
prev_hook(panic_info);
std::process::abort();
}));
}
Expand Down

0 comments on commit 2bbd3d2

Please sign in to comment.