about summary refs log tree commit diff
path: root/instrumentation/afl-compiler-rt.o.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2022-01-20 16:17:08 +0100
committerGitHub <noreply@github.com>2022-01-20 16:17:08 +0100
commit7aced239e8a0855d87ecc921ba5691b29202ec1e (patch)
treea8e877a149495ea4ec48723d8af57426f8322a3a /instrumentation/afl-compiler-rt.o.c
parent9242e0db8ac8a0e82d78432af389108e74700f00 (diff)
parentd1de12d6175cd84357eadbf204e15b184b22ae42 (diff)
downloadafl++-7aced239e8a0855d87ecc921ba5691b29202ec1e.tar.gz
Merge pull request #1294 from AFLplusplus/dev
Push to stable
Diffstat (limited to 'instrumentation/afl-compiler-rt.o.c')
-rw-r--r--instrumentation/afl-compiler-rt.o.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c
index 1b9fdee3..a84f31e3 100644
--- a/instrumentation/afl-compiler-rt.o.c
+++ b/instrumentation/afl-compiler-rt.o.c
@@ -1433,9 +1433,12 @@ void __sanitizer_cov_trace_pc_guard_init(uint32_t *start, uint32_t *stop) {
 
     } else {
 
+      static u32 offset = 4;
+
       while (start < stop) {
 
-        *(start++) = 4;
+        *(start++) = offset;
+        if (unlikely(++offset >= __afl_final_loc)) { offset = 4; }
 
       }
 
@@ -1444,7 +1447,7 @@ void __sanitizer_cov_trace_pc_guard_init(uint32_t *start, uint32_t *stop) {
   }
 
   x = getenv("AFL_INST_RATIO");
-  if (x) inst_ratio = (u32)atoi(x);
+  if (x) { inst_ratio = (u32)atoi(x); }
 
   if (!inst_ratio || inst_ratio > 100) {