about summary refs log tree commit diff
path: root/examples
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-07-16 00:24:37 +0200
committervan Hauser <vh@thc.org>2020-07-16 00:24:37 +0200
commit2077309c8d84f2f18c773b4e1b1638cff333a88e (patch)
treec0854ed4a4a360d489a5649007136c213ec98fca /examples
parent08d3169df4950458a8b401f6140c8e98fdb3cd81 (diff)
downloadafl++-2077309c8d84f2f18c773b4e1b1638cff333a88e.tar.gz
fix afl-frida
Diffstat (limited to 'examples')
-rw-r--r--examples/afl_frida/afl-frida.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/afl_frida/afl-frida.c b/examples/afl_frida/afl-frida.c
index 76732aeb..7038e1bd 100644
--- a/examples/afl_frida/afl-frida.c
+++ b/examples/afl_frida/afl-frida.c
@@ -127,6 +127,7 @@ void                 __afl_manual_init();
 
 // Because we do our own logging.
 extern uint8_t *__afl_area_ptr;
+ static __thread guint64 previous_pc;
 
 // Frida stuff below.
 typedef struct {
@@ -138,9 +139,7 @@ typedef struct {
 
 inline static void afl_maybe_log(guint64 current_pc) {
 
-  static __thread guint64 previous_pc;
-
-  // fprintf(stderr, "PC: %p\n", current_pc);
+  // fprintf(stderr, "PC: %p ^ %p\n", current_pc, previous_pc);
 
   current_pc = (current_pc >> 4) ^ (current_pc << 8);
   current_pc &= MAP_SIZE - 1;
@@ -502,6 +501,8 @@ int main() {
 
   while (__afl_persistent_loop(UINT32_MAX) != 0) {
 
+    previous_pc = 0;  // Required!
+
 #ifdef _DEBUG
     fprintf(stderr, "CLIENT crc: %016llx len: %u\n", hash64(__afl_fuzz_ptr, *__a
     fprintf(stderr, "RECV:");