From a455ad27a9037e3babbfa695a60a8c2e6c324bc7 Mon Sep 17 00:00:00 2001 From: Aarnav Date: Thu, 6 Jun 2024 19:50:29 +0200 Subject: [PATCH] Fix WeightedScheduler reporting incorrect queue cylces (#2281) * fix WeightedScheduler reporting incorrect queue cylces * check if runs_in_cycle equals or greater instead of just equals --------- Co-authored-by: Dongjia "toka" Zhang --- libafl/src/schedulers/weighted.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libafl/src/schedulers/weighted.rs b/libafl/src/schedulers/weighted.rs index 79dce6a5a9..7cbeff9ab1 100644 --- a/libafl/src/schedulers/weighted.rs +++ b/libafl/src/schedulers/weighted.rs @@ -324,13 +324,13 @@ where let wsmeta = state.metadata_mut::()?; - let current_cycles = wsmeta.runs_in_current_cycle(); + let runs_in_current_cycle = wsmeta.runs_in_current_cycle(); // TODO deal with corpus_counts decreasing due to removals - if current_cycles >= corpus_counts { + if runs_in_current_cycle >= corpus_counts { wsmeta.set_runs_current_cycle(0); } else { - wsmeta.set_runs_current_cycle(current_cycles + 1); + wsmeta.set_runs_current_cycle(runs_in_current_cycle + 1); } let idx = if probability < *wsmeta.alias_probability().get(&s).unwrap() { @@ -340,7 +340,7 @@ where }; // Update depth - if current_cycles > corpus_counts { + if runs_in_current_cycle >= corpus_counts { let psmeta = state.metadata_mut::()?; psmeta.set_queue_cycles(psmeta.queue_cycles() + 1); }