diff --git a/libafl/src/mutators/mopt_mutator.rs b/libafl/src/mutators/mopt_mutator.rs index 6f923d9a3f..377d0f6580 100644 --- a/libafl/src/mutators/mopt_mutator.rs +++ b/libafl/src/mutators/mopt_mutator.rs @@ -532,7 +532,9 @@ where { /// Create a new [`StdMOptMutator`]. pub fn new(state: &mut S, mutations: MT, swarm_num: usize) -> Result { - state.add_metadata::(MOpt::new(mutations.len(), swarm_num)?); + if !state.has_metadata::() { + state.add_metadata::(MOpt::new(mutations.len(), swarm_num)?); + } Ok(Self { mode: MOptMode::Pilotfuzzing, finds_before: 0, diff --git a/libafl/src/schedulers/accounting.rs b/libafl/src/schedulers/accounting.rs index ee31da7bba..a8d739ccd4 100644 --- a/libafl/src/schedulers/accounting.rs +++ b/libafl/src/schedulers/accounting.rs @@ -263,7 +263,16 @@ where /// Creates a new [`CoverageAccountingScheduler`] that wraps a `base` [`Scheduler`] /// and has a default probability to skip non-faved [`Testcase`]s of [`DEFAULT_SKIP_NON_FAVORED_PROB`]. pub fn new(state: &mut S, base: CS, accounting_map: &'a [u32]) -> Self { - state.add_metadata(TopAccountingMetadata::new(accounting_map.len())); + match state.metadata().get::() { + Some(meta) => { + if meta.max_accounting.len() != accounting_map.len() { + state.add_metadata(TopAccountingMetadata::new(accounting_map.len())); + } + } + None => { + state.add_metadata(TopAccountingMetadata::new(accounting_map.len())); + } + } Self { accounting_map, inner: MinimizerScheduler::new(base), @@ -279,7 +288,16 @@ where skip_non_favored_prob: u64, accounting_map: &'a [u32], ) -> Self { - state.add_metadata(TopAccountingMetadata::new(accounting_map.len())); + match state.metadata().get::() { + Some(meta) => { + if meta.max_accounting.len() != accounting_map.len() { + state.add_metadata(TopAccountingMetadata::new(accounting_map.len())); + } + } + None => { + state.add_metadata(TopAccountingMetadata::new(accounting_map.len())); + } + } Self { accounting_map, inner: MinimizerScheduler::with_skip_prob(base, skip_non_favored_prob), diff --git a/libafl/src/stages/power.rs b/libafl/src/stages/power.rs index 86545aad0e..88bddf82b1 100644 --- a/libafl/src/stages/power.rs +++ b/libafl/src/stages/power.rs @@ -182,7 +182,9 @@ where { /// Creates a new [`PowerMutationalStage`] pub fn new(state: &mut S, mutator: M, map_observer_name: &O, strat: PowerSchedule) -> Self { - state.add_metadata::(PowerScheduleMetadata::new(strat)); + if !state.has_metadata::() { + state.add_metadata::(PowerScheduleMetadata::new(strat)); + } Self { map_observer_name: map_observer_name.name().to_string(), mutator,