diff options
author | hexcoder- <heiko@hexco.de> | 2019-10-21 23:07:05 +0200 |
---|---|---|
committer | hexcoder- <heiko@hexco.de> | 2019-10-21 23:07:05 +0200 |
commit | a033364d55332530b15f2a0f2863b3448bb2bab9 (patch) | |
tree | ba72de0276c7b862952b4bf7e4ea03edb12d2df0 | |
parent | bc3ce26e0ecbf97751c6eb444df8e5bf31dcafd7 (diff) | |
download | afl++-a033364d55332530b15f2a0f2863b3448bb2bab9.tar.gz |
implement neverZero counter for __afl_trace()
-rw-r--r-- | gcc_plugin/afl-gcc-rt.o.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc_plugin/afl-gcc-rt.o.c b/gcc_plugin/afl-gcc-rt.o.c index dd79a0ec..6cf9f167 100644 --- a/gcc_plugin/afl-gcc-rt.o.c +++ b/gcc_plugin/afl-gcc-rt.o.c @@ -50,8 +50,10 @@ static u8 is_persistent; void __afl_trace(u32 x) { u32 l = __afl_prev_loc; - u32 n = l ^ x; - *(__afl_area_ptr + n) += 1; + const u32 n = l ^ x; + u8 *const bitmap_ptr = __afl_area_ptr + n; + *bitmap_ptr += 1 + (*bitmap_ptr == (u8)~0); /* neverZero */ + __afl_prev_loc = (x >> 1); return; |