From 18a25d3b3dd630943f88f62a0e590008545b8738 Mon Sep 17 00:00:00 2001 From: lazymio Date: Fri, 14 Jun 2024 19:29:38 +0800 Subject: [PATCH] Fix debug assert on map_state.num_covered_map_indexes (#2310) --- libafl/src/feedbacks/map.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libafl/src/feedbacks/map.rs b/libafl/src/feedbacks/map.rs index 127c0245a9..97f36cf2fe 100644 --- a/libafl/src/feedbacks/map.rs +++ b/libafl/src/feedbacks/map.rs @@ -495,10 +495,11 @@ where .enumerate() .filter(|(_, value)| *value != initial) { - if history_map[i] == initial { + let val = R::reduce(history_map[i], value); + if history_map[i] == initial && val != initial { map_state.num_covered_map_indexes += 1; } - history_map[i] = R::reduce(history_map[i], value); + history_map[i] = val; indices.push(i); } let meta = MapIndexesMetadata::new(indices); @@ -510,10 +511,11 @@ where .enumerate() .filter(|(_, value)| *value != initial) { - if history_map[i] == initial { + let val = R::reduce(history_map[i], value); + if history_map[i] == initial && val != initial { map_state.num_covered_map_indexes += 1; } - history_map[i] = R::reduce(history_map[i], value); + history_map[i] = val; } }