Skip to content

Commit

Permalink
fix metadata removal for ExecutionCountRestartHelper (AFLplusplus#2705)
Browse files Browse the repository at this point in the history
  • Loading branch information
henryhchchc authored and riesentoaster committed Nov 21, 2024
1 parent 80cb547 commit 9cf1420
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions libafl/src/stages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,12 +699,12 @@ impl ExecutionCountRestartHelper {
}

/// Clear progress for the stage this wrapper wraps.
pub fn clear_progress<S>(&mut self, state: &mut S) -> Result<(), Error>
pub fn clear_progress<S>(&mut self, state: &mut S, name: &str) -> Result<(), Error>
where
S: HasMetadata,
S: HasNamedMetadata,
{
self.started_at_execs = None;
let _metadata = state.remove_metadata::<ExecutionCountRestartHelperMetadata>();
let _metadata = state.remove_named_metadata::<ExecutionCountRestartHelperMetadata>(name);
debug_assert!(_metadata.is_some(), "Called clear_progress, but should_restart was not called before (or did mutational stages get nested?)");
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/stages/tmin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ where
}

fn clear_progress(&mut self, state: &mut Self::State) -> Result<(), Error> {
self.restart_helper.clear_progress(state)
self.restart_helper.clear_progress(state, &self.name)
}

fn perform(
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/stages/tuneable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ where
}

fn clear_progress(&mut self, state: &mut Self::State) -> Result<(), Error> {
self.restart_helper.clear_progress(state)
self.restart_helper.clear_progress(state, &self.name)
}
}

Expand Down

0 comments on commit 9cf1420

Please sign in to comment.