Skip to content

Commit c41944b

Browse files
vanhauser-thcsmoelius
authored andcommitted
use afl::
1 parent 406a6a8 commit c41944b

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

afl/src/lib.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ macro_rules! ijon_inc {
4646
static mut loc: u32 = 0;
4747
if loc == 0 {
4848
let cfile = std::ffi::CString::new(file!()).unwrap();
49-
loc = ijon_hashstr(line!(), cfile.as_ptr());
49+
loc = afl::ijon_hashstr(line!(), cfile.as_ptr());
5050
}
51-
ijon_inc(loc, $x)
51+
afl::ijon_inc(loc, $x)
5252
};
5353
}};
5454
}
@@ -60,9 +60,9 @@ macro_rules! ijon_max {
6060
static mut loc: u32 = 0;
6161
if loc == 0 {
6262
let cfile = std::ffi::CString::new(file!()).unwrap();
63-
loc = ijon_hashstr(line!(), cfile.as_ptr());
63+
loc = afl::ijon_hashstr(line!(), cfile.as_ptr());
6464
}
65-
ijon_max_variadic(_IJON_LOC_CACHE, $($x),+, 0u64)
65+
afl::ijon_max_variadic(_IJON_LOC_CACHE, $($x),+, 0u64)
6666
};
6767
}};
6868
}
@@ -74,9 +74,9 @@ macro_rules! ijon_min {
7474
static mut loc: u32 = 0;
7575
if loc == 0 {
7676
let cfile = std::ffi::CString::new(file!()).unwrap();
77-
loc = ijon_hashstr(line!(), cfile.as_ptr());
77+
loc = afl::ijon_hashstr(line!(), cfile.as_ptr());
7878
}
79-
ijon_min_variadic(loc, $($x),+, 0u64)
79+
afl::ijon_min_variadic(loc, $($x),+, 0u64)
8080
};
8181
}};
8282
}
@@ -88,43 +88,43 @@ macro_rules! ijon_set {
8888
static mut loc: u32 = 0;
8989
if loc == 0 {
9090
let cfile = std::ffi::CString::new(file!()).unwrap();
91-
loc = ijon_hashstr(line!(), cfile.as_ptr());
91+
loc = afl::ijon_hashstr(line!(), cfile.as_ptr());
9292
}
93-
ijon_set(loc, $x)
93+
afl::ijon_set(loc, $x)
9494
};
9595
}};
9696
}
9797

9898
#[macro_export]
9999
macro_rules! ijon_state {
100100
($n:expr) => {
101-
unsafe { ijon_xor_state($n) }
101+
unsafe { afl::ijon_xor_state($n) }
102102
};
103103
}
104104

105105
#[macro_export]
106106
macro_rules! ijon_ctx {
107107
($x:expr) => {{
108108
let cfile = std::ffi::CString::new(file!()).unwrap();
109-
let hash = unsafe { ijon_hashstr(line!(), cfile.as_ptr()) };
110-
unsafe { ijon_xor_state(hash) };
109+
let hash = unsafe { afl::ijon_hashstr(line!(), cfile.as_ptr()) };
110+
unsafe { afl::ijon_xor_state(hash) };
111111
let temp = $x;
112-
unsafe { ijon_xor_state(hash) };
112+
unsafe { afl::ijon_xor_state(hash) };
113113
temp
114114
}};
115115
}
116116

117117
#[macro_export]
118118
macro_rules! ijon_max_at {
119119
($addr:expr, $x:expr) => {
120-
unsafe { ijon_max($addr, $x) }
120+
unsafe { afl::ijon_max($addr, $x) }
121121
};
122122
}
123123

124124
#[macro_export]
125125
macro_rules! ijon_min_at {
126126
($addr:expr, $x:expr) => {
127-
unsafe { ijon_min($addr, $x) }
127+
unsafe { afl::ijon_min($addr, $x) }
128128
};
129129
}
130130

@@ -139,8 +139,8 @@ macro_rules! _ijon_abs_dist {
139139
macro_rules! ijon_bits {
140140
($x:expr) => {
141141
unsafe {
142-
ijon_set(ijon_hashint(
143-
ijon_hashstack(),
142+
afl::ijon_set(afl::ijon_hashint(
143+
afl::ijon_hashstack(),
144144
if $x == 0 {
145145
0
146146
} else {
@@ -154,16 +154,16 @@ macro_rules! ijon_bits {
154154
#[macro_export]
155155
macro_rules! ijon_strdist {
156156
($x:expr, $y:expr) => {
157-
unsafe { ijon_set(ijon_hashint(ijon_hashstack(), ijon_strdist($x, $y))) }
157+
unsafe { afl::ijon_set(afl::ijon_hashint(afl::ijon_hashstack(), afl::ijon_strdist($x, $y))) }
158158
};
159159
}
160160

161161
#[macro_export]
162162
macro_rules! ijon_dist {
163163
($x:expr, $y:expr) => {
164164
unsafe {
165-
ijon_set(ijon_hashint(
166-
ijon_hashstack(),
165+
afl::ijon_set(afl::ijon_hashint(
166+
afl::ijon_hashstack(),
167167
$crate::_ijon_abs_dist!($x, $y),
168168
))
169169
}
@@ -173,7 +173,7 @@ macro_rules! ijon_dist {
173173
#[macro_export]
174174
macro_rules! ijon_cmp {
175175
($x:expr, $y:expr) => {
176-
unsafe { ijon_inc(ijon_hashint(ijon_hashstack(), ($x ^ $y).count_ones())) }
176+
unsafe { afl::ijon_inc(afl::ijon_hashint(afl::ijon_hashstack(), ($x ^ $y).count_ones())) }
177177
};
178178
}
179179

@@ -184,9 +184,9 @@ macro_rules! ijon_stack_max {
184184
static mut loc: u32 = 0;
185185
if loc == 0 {
186186
let cfile = std::ffi::CString::new(file!()).unwrap();
187-
loc = ijon_hashstr(line!(), cfile.as_ptr());
187+
loc = afl::ijon_hashstr(line!(), cfile.as_ptr());
188188
}
189-
ijon_max(ijon_hashint(loc, ijon_hashstack()), $x)
189+
afl::ijon_max(afl::ijon_hashint(loc, afl::ijon_hashstack()), $x)
190190
};
191191
}};
192192
}
@@ -198,9 +198,9 @@ macro_rules! ijon_stack_min {
198198
static mut loc: u32 = 0;
199199
if loc == 0 {
200200
let cfile = std::ffi::CString::new(file!()).unwrap();
201-
loc = ijon_hashstr(line!(), cfile.as_ptr());
201+
loc = afl::ijon_hashstr(line!(), cfile.as_ptr());
202202
}
203-
ijon_min(ijon_hashint(loc, ijon_hashstack()), $x)
203+
afl::ijon_min(afl::ijon_hashint(loc, afl::ijon_hashstack()), $x)
204204
};
205205
}};
206206
}

cargo-afl/tests/integration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn integration_cfg() {
4646
.arg("--manifest-path")
4747
.arg("../afl/Cargo.toml")
4848
.envs(if cfg_fuzzing {
49-
vec![]
49+
vec![("AFL_BENCH_UNTIL_CRASH", "1")]
5050
} else {
5151
vec![("AFL_NO_CFG_FUZZING", "1")]
5252
})

0 commit comments

Comments
 (0)