aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2023-04-05 13:07:22 +0200
committervanhauser-thc <vh@thc.org>2023-04-05 13:07:22 +0200
commitdba93705a79fb859ce0ede606f79dd4ed203725b (patch)
tree77e871775383e6e6425e0d5bd5d45cc035913c79
parent36127fb1970746f53fec44f9394061f57a4e94c3 (diff)
downloadafl++-dba93705a79fb859ce0ede606f79dd4ed203725b.tar.gz
better new weighting
-rw-r--r--src/afl-fuzz-queue.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c
index 1cdc8b54..3335e869 100644
--- a/src/afl-fuzz-queue.c
+++ b/src/afl-fuzz-queue.c
@@ -74,15 +74,17 @@ double compute_weight(afl_state_t *afl, struct queue_entry *q,
if (likely(afl->schedule < RARE)) { weight *= (avg_exec_us / q->exec_us); }
weight *= (log(q->bitmap_size) / avg_bitmap_size);
weight *= (1 + (q->tc_ref / avg_top_size));
- if (unlikely(weight < 0.1)) { weight = 0.1; }
- if (unlikely(q->favored)) { weight *= 5; }
- if (unlikely(!q->was_fuzzed)) { weight *= 2; }
+
if (unlikely(afl->prefer_new)) {
- weight *= (2.0 * (q->id / (afl->queued_items - 1)));
+ weight *= (2.0 * ((1 + q->id) / afl->queued_items));
}
+ if (unlikely(weight < 0.1)) { weight = 0.1; }
+ if (unlikely(q->favored)) { weight *= 5; }
+ if (unlikely(!q->was_fuzzed)) { weight *= 2; }
+
return weight;
}