This commit is contained in:
vanhauser-thc 2024-06-28 16:47:20 +02:00
parent d869913efa
commit 3f065ea70a

View File

@ -65,6 +65,12 @@ double compute_weight(afl_state_t *afl, struct queue_entry *q,
double avg_exec_us, double avg_bitmap_size, double avg_exec_us, double avg_bitmap_size,
double avg_top_size, double avg_score) { double avg_top_size, double avg_score) {
if (unlikely(afl->fuzz_mode && avg_score > 0)) {
return q->score / avg_score;
} else {
double weight = 1.0; double weight = 1.0;
if (likely(afl->schedule >= FAST && afl->schedule <= RARE)) { if (likely(afl->schedule >= FAST && afl->schedule <= RARE)) {
@ -75,7 +81,8 @@ double compute_weight(afl_state_t *afl, struct queue_entry *q,
} }
#ifdef DEBUG_QUEUE #ifdef DEBUG_QUEUE
fprintf(stderr, "WEIGHT id=%u fname=%s start_weight=1.0\n", q->id, q->fname); fprintf(stderr, "WEIGHT id=%u fname=%s start_weight=1.0\n", q->id,
q->fname);
fprintf(stderr, " after step 1: %.2f (log10(hits))\n", weight); fprintf(stderr, " after step 1: %.2f (log10(hits))\n", weight);
#endif #endif
if (likely(afl->schedule < RARE)) { weight *= (avg_exec_us / q->exec_us); } if (likely(afl->schedule < RARE)) { weight *= (avg_exec_us / q->exec_us); }
@ -119,6 +126,8 @@ double compute_weight(afl_state_t *afl, struct queue_entry *q,
} }
}
/* create the alias table that allows weighted random selection - expensive */ /* create the alias table that allows weighted random selection - expensive */
void create_alias_table(afl_state_t *afl) { void create_alias_table(afl_state_t *afl) {