diff options
author | Leon Weiß <leon.weiss@rub.de> | 2024-02-23 13:39:46 +0100 |
---|---|---|
committer | Leon Weiß <leon.weiss@rub.de> | 2024-02-23 13:39:46 +0100 |
commit | fae760fc9e4c63385c24fe07e5d5c3ab077b56bf (patch) | |
tree | 6ed1e0f8a6556f1539ff342405ad47d87776bb47 /src | |
parent | 01f442d81016188e847eae5320882cb1fbfa6dc8 (diff) | |
download | afl++-fae760fc9e4c63385c24fe07e5d5c3ab077b56bf.tar.gz |
Add upper and lower safety margins
Diffstat (limited to 'src')
-rw-r--r-- | src/afl-fuzz.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index 803a1acc..08f716fa 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -2496,6 +2496,15 @@ int main(int argc, char **argv_orig, char **envp) { if ((afl->queue_buf[entry]->exec_us/1000) > max_ms) max_ms = afl->queue_buf[entry]->exec_us/1000; + // Add 20% as a safety margin, capped to exec_tmout given in -t option + max_ms *= 1.2; + if(max_ms > afl->fsrv.exec_tmout) + max_ms = afl->fsrv.exec_tmout; + + // Ensure that there is a sensible timeout even for very fast binaries + if(max_ms < 5) + max_ms = 5; + afl->fsrv.exec_tmout = max_ms; afl->timeout_given = 1; |