about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2023-04-05 09:42:27 +0200
committervanhauser-thc <vh@thc.org>2023-04-05 09:42:27 +0200
commit1fc0731604c1ea1abb38ab345d9046a6f1e9b7de (patch)
treee0f2a754f4ec8f2ce0f9b1019741afefa7647768
parent53b70ef104a334424fd5226c7504130b3bd45625 (diff)
downloadafl++-1fc0731604c1ea1abb38ab345d9046a6f1e9b7de.tar.gz
stack pow
-rw-r--r--src/afl-fuzz-one.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/afl-fuzz-one.c b/src/afl-fuzz-one.c
index bc267b15..48aa6eb0 100644
--- a/src/afl-fuzz-one.c
+++ b/src/afl-fuzz-one.c
@@ -2076,7 +2076,7 @@ havoc_stage:
      where we take the input file and make random stacked tweaks. */
 
   u32 *mutation_array;
-  u32  stack_max;
+  u32  stack_max, stack_max_pow = afl->havoc_stack_pow2;
 
   if (unlikely(afl->text_input || afl->queue_cur->is_ascii)) {  // is text?
 
@@ -2106,22 +2106,20 @@ havoc_stage:
 
   if (temp_len < 64) {
 
-    stack_max = 4;
+    --stack_max_pow;
 
-  } else if (temp_len < 512) {
+  } else if (temp_len <= 8096) {
 
-    stack_max = 8;
-
-  } else if (temp_len < 8096) {
-
-    stack_max = 16;
+    ++stack_max_pow;
 
   } else {
 
-    stack_max = 32;
+    ++stack_max_pow;
 
   }
 
+  stack_max = 1 << stack_max_pow;
+
   // + (afl->extras_cnt ? 2 : 0) + (afl->a_extras_cnt ? 2 : 0);
 
   for (afl->stage_cur = 0; afl->stage_cur < afl->stage_max; ++afl->stage_cur) {