about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorKobrin Eli <kobrineli@ispras.ru>2022-10-15 13:06:11 +0300
committerGitHub <noreply@github.com>2022-10-15 12:06:11 +0200
commit26d477167850914be1404cca6d2f9e28d2102e1d (patch)
treed084aa3acb6dd8eacf6dc8a8f194598562c1a730 /src
parent77ebab64d3826e0644dc75b05916893ec8929e68 (diff)
downloadafl++-26d477167850914be1404cca6d2f9e28d2102e1d.tar.gz
Fix exit_on_time (#1555)
Diffstat (limited to 'src')
-rw-r--r--src/afl-fuzz-stats.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c
index 713f3a3c..ef5c698c 100644
--- a/src/afl-fuzz-stats.c
+++ b/src/afl-fuzz-stats.c
@@ -1410,12 +1410,13 @@ void show_stats_pizza(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 &&
+		(afl->prev_run_time + cur_ms - afl->start_time) > afl->exit_on_time))) {
     afl->stop_soon = 2;
-
   }
 
   if (unlikely(afl->total_crashes && afl->afl_env.afl_bench_until_crash)) {