Skip to content

Commit

Permalink
Keep num_covered_map_indexes in sync with history map if block listin…
Browse files Browse the repository at this point in the history
…g flaky entries (#2542)
  • Loading branch information
nbars authored Sep 24, 2024
1 parent f0d85aa commit bacbffa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions libafl/src/stages/calibrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ where
.as_ref()
.to_vec();

let history_map = &mut state
let map_state = state
.named_metadata_map_mut()
.get_mut::<MapFeedbackMetadata<O::Entry>>(&self.map_name)
.unwrap()
.history_map;
.unwrap();
let history_map = &mut map_state.history_map;

if history_map.len() < map_first_len {
history_map.resize(map_first_len, O::Entry::default());
Expand All @@ -228,6 +228,10 @@ where
.enumerate()
{
if *first != *cur && *history != O::Entry::max_value() {
// If we just hit a history map entry that was not covered before, but is now flagged as flaky,
// we need to make sure the `num_covered_map_indexes` is kept in sync.
map_state.num_covered_map_indexes +=
usize::from(*history == O::Entry::default());
*history = O::Entry::max_value();
unstable_entries.push(idx);
};
Expand Down

0 comments on commit bacbffa

Please sign in to comment.