Skip to content

Commit

Permalink
avoid requiring SafeUnwind
Browse files Browse the repository at this point in the history
  • Loading branch information
mcginty committed Jul 19, 2018
1 parent 7840555 commit 66b32e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ lazy_static! {
}

#[cfg(all(fuzzing, not(fuzzing_debug)))]
pub fn fuzz<F>(closure: F) where F: FnOnce(&[u8]) + std::panic::UnwindSafe {
pub fn fuzz<F>(closure: F) where F: FnOnce(&[u8]) {
// sets panic hook if not already done
lazy_static::initialize(&PANIC_HOOK);

Expand All @@ -266,9 +266,9 @@ pub fn fuzz<F>(closure: F) where F: FnOnce(&[u8]) + std::panic::UnwindSafe {
// the panic hook.
// If so, the fuzzer will be unable to tell different bugs appart and you will
// only be able to find one bug at a time before fixing it to then find a new one.
let did_panic = std::panic::catch_unwind(|| {
let did_panic = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
closure(buf);
}).is_err();
})).is_err();

if did_panic {
// hopefully the custom panic hook will be called before and abort the
Expand Down

0 comments on commit 66b32e1

Please sign in to comment.