From 7623aa46f9c8fb7a64e999ba889cd1a75ccc9916 Mon Sep 17 00:00:00 2001 From: Henry Chu Date: Tue, 19 Nov 2024 21:36:19 +0800 Subject: [PATCH] fix metadata removal for ExecutionCountRestartHelper (#2705) --- libafl/src/stages/mod.rs | 6 +++--- libafl/src/stages/tmin.rs | 2 +- libafl/src/stages/tuneable.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libafl/src/stages/mod.rs b/libafl/src/stages/mod.rs index bcb6b8f2d4..5dcad0aaca 100644 --- a/libafl/src/stages/mod.rs +++ b/libafl/src/stages/mod.rs @@ -699,12 +699,12 @@ impl ExecutionCountRestartHelper { } /// Clear progress for the stage this wrapper wraps. - pub fn clear_progress(&mut self, state: &mut S) -> Result<(), Error> + pub fn clear_progress(&mut self, state: &mut S, name: &str) -> Result<(), Error> where - S: HasMetadata, + S: HasNamedMetadata, { self.started_at_execs = None; - let _metadata = state.remove_metadata::(); + let _metadata = state.remove_named_metadata::(name); debug_assert!(_metadata.is_some(), "Called clear_progress, but should_restart was not called before (or did mutational stages get nested?)"); Ok(()) } diff --git a/libafl/src/stages/tmin.rs b/libafl/src/stages/tmin.rs index b3e61e07bb..d77299e73f 100644 --- a/libafl/src/stages/tmin.rs +++ b/libafl/src/stages/tmin.rs @@ -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( diff --git a/libafl/src/stages/tuneable.rs b/libafl/src/stages/tuneable.rs index 0bd73d3a50..b293282ae3 100644 --- a/libafl/src/stages/tuneable.rs +++ b/libafl/src/stages/tuneable.rs @@ -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) } }