From ed53a165074db55428f7b82428b1e11d5fb757ac Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Mon, 4 Dec 2023 11:52:44 -0500 Subject: [PATCH] Call existing panic hook before aborting --- afl/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/afl/src/lib.rs b/afl/src/lib.rs index b9a6bc69c..9d0e52848 100644 --- a/afl/src/lib.rs +++ b/afl/src/lib.rs @@ -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(); })); }