diff options
author | van Hauser <vh@thc.org> | 2023-08-22 17:32:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-22 17:32:56 +0000 |
commit | b397bdc3d976921a9b936f21273adc3a1bf9d4f4 (patch) | |
tree | 454e220dae35bd009710ef75a7ec77b44520b935 /src/afl-fuzz-queue.c | |
parent | f596a297c4de6a5e1a6fb9fbb3b4e18124a24f58 (diff) | |
parent | e2026f7b71752c9b0bbba7438e2c62f2a4bca7f0 (diff) | |
download | afl++-b397bdc3d976921a9b936f21273adc3a1bf9d4f4.tar.gz |
Merge pull request #1841 from AFLplusplus/dev
Dev
Diffstat (limited to 'src/afl-fuzz-queue.c')
-rw-r--r-- | src/afl-fuzz-queue.c | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c index 48fd33ec..14ba1ace 100644 --- a/src/afl-fuzz-queue.c +++ b/src/afl-fuzz-queue.c @@ -701,13 +701,20 @@ void update_bitmap_score(afl_state_t *afl, struct queue_entry *q) { u64 fav_factor; u64 fuzz_p2; - if (unlikely(afl->schedule >= FAST && afl->schedule < RARE)) + if (likely(afl->schedule >= FAST && afl->schedule < RARE)) { + fuzz_p2 = 0; // Skip the fuzz_p2 comparison - else if (unlikely(afl->schedule == RARE)) + + } else if (unlikely(afl->schedule == RARE)) { + fuzz_p2 = next_pow2(afl->n_fuzz[q->n_fuzz_entry]); - else + + } else { + fuzz_p2 = q->fuzz_level; + } + if (unlikely(afl->schedule >= RARE) || unlikely(afl->fixed_seed)) { fav_factor = q->len << 2; @@ -729,47 +736,32 @@ void update_bitmap_score(afl_state_t *afl, struct queue_entry *q) { /* Faster-executing or smaller test cases are favored. */ u64 top_rated_fav_factor; u64 top_rated_fuzz_p2; - if (unlikely(afl->schedule >= FAST && afl->schedule <= RARE)) - top_rated_fuzz_p2 = - next_pow2(afl->n_fuzz[afl->top_rated[i]->n_fuzz_entry]); - else - top_rated_fuzz_p2 = afl->top_rated[i]->fuzz_level; - if (unlikely(afl->schedule >= RARE) || unlikely(afl->fixed_seed)) { + if (likely(afl->schedule >= FAST && afl->schedule <= RARE)) { - top_rated_fav_factor = afl->top_rated[i]->len << 2; + top_rated_fuzz_p2 = + next_pow2(afl->n_fuzz[afl->top_rated[i]->n_fuzz_entry]); } else { - top_rated_fav_factor = - afl->top_rated[i]->exec_us * afl->top_rated[i]->len; - - } - - if (fuzz_p2 > top_rated_fuzz_p2) { - - continue; - - } else if (fuzz_p2 == top_rated_fuzz_p2) { - - if (fav_factor > top_rated_fav_factor) { continue; } + top_rated_fuzz_p2 = afl->top_rated[i]->fuzz_level; } if (unlikely(afl->schedule >= RARE) || unlikely(afl->fixed_seed)) { - if (fav_factor > afl->top_rated[i]->len << 2) { continue; } + top_rated_fav_factor = afl->top_rated[i]->len << 2; } else { - if (fav_factor > - afl->top_rated[i]->exec_us * afl->top_rated[i]->len) { + top_rated_fav_factor = + afl->top_rated[i]->exec_us * afl->top_rated[i]->len; - continue; + } - } + if (likely(fuzz_p2 > top_rated_fuzz_p2)) { continue; } - } + if (likely(fav_factor > top_rated_fav_factor)) { continue; } /* Looks like we're going to win. Decrease ref count for the previous winner, discard its afl->fsrv.trace_bits[] if necessary. */ |