diff options
author | van Hauser <vh@thc.org> | 2020-10-22 21:07:37 +0200 |
---|---|---|
committer | van Hauser <vh@thc.org> | 2020-10-22 21:07:37 +0200 |
commit | c866aef37fcf799506d93b9a47d4eb2b77c75f5b (patch) | |
tree | 05a98cd9d4b3fe51190873f0a2845cf50539032b /src | |
parent | 8d75c089384a0975e39e54f3ba23c37a6101b61c (diff) | |
download | afl++-c866aef37fcf799506d93b9a47d4eb2b77c75f5b.tar.gz |
maybe enhancement to cache algo
Diffstat (limited to 'src')
-rw-r--r-- | src/afl-fuzz-queue.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c index 3e6deb0c..db387c33 100644 --- a/src/afl-fuzz-queue.c +++ b/src/afl-fuzz-queue.c @@ -1004,13 +1004,15 @@ inline u8 *queue_testcase_get(afl_state_t *afl, struct queue_entry *q) { afl->q_testcase_cache[tid] = NULL; --afl->q_testcase_cache_count; ++afl->q_testcase_evictions; + if (tid < afl->q_testcase_smallest_free) + afl->q_testcase_smallest_free = tid; } - if (tid >= TESTCASE_ENTRIES) { + if (unlikely(tid >= TESTCASE_ENTRIES)) { // uh we were full, so now we have to search from start - tid = 0; + tid = afl->q_testcase_smallest_free; } @@ -1042,6 +1044,8 @@ inline u8 *queue_testcase_get(afl_state_t *afl, struct queue_entry *q) { ++afl->q_testcase_cache_count; if (tid >= afl->q_testcase_max_cache_count) afl->q_testcase_max_cache_count = tid + 1; + if (tid == afl->q_testcase_smallest_free) + afl->q_testcase_smallest_free = tid + 1; } |