about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2019-11-12 23:12:14 +0100
committerhexcoder- <heiko@hexco.de>2019-11-12 23:12:14 +0100
commit7f017aa724a9324492f1b19937c6097c8aed555a (patch)
treef210c7aff4d14508170eea55d27cb65427a92936
parentd51719fbd9aaa5b61bfdca8dbd4c0ed992033654 (diff)
downloadafl++-7f017aa724a9324492f1b19937c6097c8aed555a.tar.gz
enabled neverZero feature again
-rw-r--r--gcc_plugin/afl-gcc-rt.o.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/gcc_plugin/afl-gcc-rt.o.c b/gcc_plugin/afl-gcc-rt.o.c
index 5b70a247..1fb9e099 100644
--- a/gcc_plugin/afl-gcc-rt.o.c
+++ b/gcc_plugin/afl-gcc-rt.o.c
@@ -9,8 +9,6 @@
    GCC integration design is based on the LLVM design, which comes
    from Laszlo Szekeres.
 
-   Copyright 2015 Google Inc. All rights reserved.
-
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at:
@@ -55,15 +53,13 @@ __thread u32 __afl_prev_loc;
 #endif
 
 /* Trace a basic block with some ID */
-void __afl_trace(u32 x) {
-
-  u32 l = __afl_prev_loc;
+void __afl_trace(const u32 x) {
 
-#if 0 /* enable for neverZero feature. By default disabled since too inefficient :-( */
-  /* @Marc: avoid conditional jumps here */
-  __afl_area_ptr[l ^ x] += 1 + (__afl_area_ptr[l ^ x] == (u8)~0);
+#if 1 /* enable for neverZero feature. */
+  __afl_area_ptr[__afl_prev_loc ^ x] += 1 
+                               + ((u8)(1 + __afl_area_ptr[__afl_prev_loc ^ x]) == 0);
 #else
-  ++__afl_area_ptr[l ^ x];
+  ++__afl_area_ptr[__afl_prev_loc ^ x];
 #endif
 
   __afl_prev_loc = (x >> 1);