about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2023-03-03 08:26:44 +0100
committerGitHub <noreply@github.com>2023-03-03 08:26:44 +0100
commit6af195916c07766029f92bd069efedfc67a94ea4 (patch)
tree26c4c97c8afcbc05e1536845b566970d7128327b
parent12262d3a6304cd4294100507aabe438345d11420 (diff)
parent7c07437941765acbeb809d9ffc941d8bfea9be72 (diff)
downloadafl++-6af195916c07766029f92bd069efedfc67a94ea4.tar.gz
Merge pull request #1662 from kobrineli/fix-exit-on-time
Fix exit on time
-rw-r--r--src/afl-fuzz-stats.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c
index bfd30845..26e1a50e 100644
--- a/src/afl-fuzz-stats.c
+++ b/src/afl-fuzz-stats.c
@@ -669,9 +669,15 @@ void show_stats_normal(afl_state_t *afl) {
 
   /* AFL_EXIT_ON_TIME. */
 
-  if (unlikely(afl->last_find_time && !afl->non_instrumented_mode &&
-               afl->afl_env.afl_exit_on_time &&
-               (cur_ms - afl->last_find_time) > afl->exit_on_time)) {
+  /* If no coverage was found yet, check whether run time is greater than
+   * exit_on_time. */
+
+  if (unlikely(
+          !afl->non_instrumented_mode && afl->afl_env.afl_exit_on_time &&
+          ((afl->last_find_time &&
+            (cur_ms - afl->last_find_time) > afl->exit_on_time) ||
+           (!afl->last_find_time && (cur_ms - afl->start_time) 
+	                             > afl->exit_on_time)))) {
 
     afl->stop_soon = 2;
 
@@ -1474,8 +1480,8 @@ void show_stats_pizza(afl_state_t *afl) {
           !afl->non_instrumented_mode && afl->afl_env.afl_exit_on_time &&
           ((afl->last_find_time &&
             (cur_ms - afl->last_find_time) > afl->exit_on_time) ||
-           (!afl->last_find_time && (afl->prev_run_time + cur_ms -
-                                     afl->start_time) > afl->exit_on_time)))) {
+           (!afl->last_find_time && (cur_ms - afl->start_time)
+	                             > afl->exit_on_time)))) {
 
     afl->stop_soon = 2;