From 26d477167850914be1404cca6d2f9e28d2102e1d Mon Sep 17 00:00:00 2001 From: Kobrin Eli Date: Sat, 15 Oct 2022 13:06:11 +0300 Subject: Fix exit_on_time (#1555) --- src/afl-fuzz-stats.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/afl-fuzz-stats.c') 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)) { -- cgit 1.4.1 From ca9854a924bf6358aff7a54c8825917f711b35ff Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Wed, 19 Oct 2022 10:17:12 +0200 Subject: nits --- src/afl-fuzz-stats.c | 15 ++++++++++----- src/afl-showmap.c | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src/afl-fuzz-stats.c') diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c index ef5c698c..61956dc3 100644 --- a/src/afl-fuzz-stats.c +++ b/src/afl-fuzz-stats.c @@ -1410,13 +1410,18 @@ void show_stats_pizza(afl_state_t *afl) { /* AFL_EXIT_ON_TIME. */ - /* If no coverage was found yet, check whether run time is greater than 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)))) { - 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)) { diff --git a/src/afl-showmap.c b/src/afl-showmap.c index 4cc079ea..5e3fb67d 100644 --- a/src/afl-showmap.c +++ b/src/afl-showmap.c @@ -873,7 +873,7 @@ static void usage(u8 *argv0) { "printed to stdout\n" "AFL_QUIET: do not print extra informational output\n" "AFL_NO_FORKSRV: run target via execve instead of using the forkserver\n", - argv0, MEM_LIMIT, doc_path); + argv0, doc_path); exit(1); -- cgit 1.4.1