about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2023-06-20 19:58:08 +0200
committervanhauser-thc <vh@thc.org>2023-06-20 19:58:14 +0200
commit7b29f2cd244424c5385605d1302b68be44e432bc (patch)
treebca7a7f23b0dc6c6d3b803e9b9646832e2dce618
parenta0242db4216db2c858809d5063a0714433e331c6 (diff)
downloadafl++-7b29f2cd244424c5385605d1302b68be44e432bc.tar.gz
fix timeout for sessions restart and + usage
-rw-r--r--docs/Changelog.md17
-rw-r--r--src/afl-fuzz-stats.c14
-rw-r--r--src/afl-fuzz.c1
3 files changed, 17 insertions, 15 deletions
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 70f38d05..4454456e 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -4,13 +4,16 @@
   release of the tool. See README.md for the general instruction manual.
 
 ### Version ++4.08a (dev)
-  - new mutation engine: mutations that favor discovery more paths are prefered
-    until no new finds for 10 minutes then switching to mutations that favor
-    triggering crashes. Modes and switch time can be configured wie `-P`.
-  - new custom mutator that has the new afl++ engine (so it can easily
-    incorporated into new custom mutators), and also comes with a standalone
-    command line tool! See custom_mutators/aflpp/standalone/
-  - display the state of the fuzzing run in the UI :-)
+  - afl-fuzz:
+    - new mutation engine: mutations that favor discovery more paths are
+      prefered until no new finds for 10 minutes then switching to mutations
+      that favor triggering crashes. Modes and switch time can be configured
+      with `-P`.
+    - new custom mutator that has the new afl++ engine (so it can easily
+      incorporated into new custom mutators), and also comes with a standalone
+      command line tool! See custom_mutators/aflpp/standalone/
+    - display the state of the fuzzing run in the UI :-)
+    - fix timeout setting if '+' is used or a session is restarted
 
 
 ### Version ++4.07c (release)
diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c
index 1499a7e4..389b82fc 100644
--- a/src/afl-fuzz-stats.c
+++ b/src/afl-fuzz-stats.c
@@ -2303,7 +2303,12 @@ void show_init_stats(afl_state_t *afl) {
       stringify_int(IB(0), min_us), stringify_int(IB(1), max_us),
       stringify_int(IB(2), avg_us));
 
-  if (afl->timeout_given != 1) {
+  if (afl->timeout_given == 3) {
+
+    ACTF("Applying timeout settings from resumed session (%u ms).",
+         afl->fsrv.exec_tmout);
+
+  } else if (afl->timeout_given != 1) {
 
     /* Figure out the appropriate timeout. The basic idea is: 5x average or
        1x max, rounded up to EXEC_TM_ROUND ms and capped at 1 second.
@@ -2345,13 +2350,6 @@ void show_init_stats(afl_state_t *afl) {
 
     afl->timeout_given = 1;
 
-  } else if (afl->timeout_given == 3) {
-
-    ACTF("Applying timeout settings from resumed session (%u ms).",
-         afl->fsrv.exec_tmout);
-
-  } else {
-
     ACTF("-t option specified. We'll use an exec timeout of %u ms.",
          afl->fsrv.exec_tmout);
 
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index d727fff5..9eabfae1 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -2362,6 +2362,7 @@ int main(int argc, char **argv_orig, char **envp) {
             max_ms = afl->queue_buf[entry]->exec_us;
 
       afl->fsrv.exec_tmout = max_ms;
+      afl->timeout_given = 1;
 
     }