Skip to content

Commit

Permalink
Merge pull request #174 from smoelius/master
Browse files Browse the repository at this point in the history
Qualify uses of `__fuzz!` macro
  • Loading branch information
alex authored Sep 14, 2020
2 parents d156adf + 46d3acb commit 5142c99
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,26 +205,26 @@ where
/// ```
#[macro_export]
macro_rules! fuzz {
( $($x:tt)* ) => { __fuzz!(true, $($x)*) }
( $($x:tt)* ) => { $crate::__fuzz!(true, $($x)*) }
}

/// Like `fuzz!` above, but panics that are caught inside the fuzzed code are not turned into
/// crashes.
#[macro_export]
macro_rules! fuzz_nohook {
( $($x:tt)* ) => { __fuzz!(false, $($x)*) }
( $($x:tt)* ) => { $crate::__fuzz!(false, $($x)*) }
}

#[macro_export]
macro_rules! __fuzz {
($hook:expr, |$buf:ident| $body:block) => {
afl::fuzz($hook, |$buf| $body);
$crate::fuzz($hook, |$buf| $body);
};
($hook:expr, |$buf:ident: &[u8]| $body:block) => {
afl::fuzz($hook, |$buf| $body);
$crate::fuzz($hook, |$buf| $body);
};
($hook:expr, |$buf:ident: $dty: ty| $body:block) => {
afl::fuzz($hook, |$buf| {
$crate::fuzz($hook, |$buf| {
let $buf: $dty = {
use arbitrary::{Arbitrary, RingBuffer};
if let Ok(d) = RingBuffer::new($buf, $buf.len())
Expand Down

0 comments on commit 5142c99

Please sign in to comment.