From a352779c36114cd5863a486de8d826f85ed9f2f3 Mon Sep 17 00:00:00 2001 From: Toka Date: Sat, 11 Jan 2025 12:46:08 +0100 Subject: [PATCH] 3 --- libafl_targets/src/sancov_pcguard.rs | 42 ++++++++++------------------ 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/libafl_targets/src/sancov_pcguard.rs b/libafl_targets/src/sancov_pcguard.rs index cb7aa2a142..f7ebc5817f 100644 --- a/libafl_targets/src/sancov_pcguard.rs +++ b/libafl_targets/src/sancov_pcguard.rs @@ -80,24 +80,20 @@ use core::marker::PhantomData; #[cfg(any(feature = "sancov_ngram4", feature = "sancov_ngram8"))] #[rustversion::nightly] #[derive(Debug, Clone, Copy)] -pub struct NgramHook -where - S: libafl::inputs::UsesInput, +pub struct NgramHook { - phantom: PhantomData, + phantom: PhantomData<(I, S)>, } /// The hook to initialize ctx everytime we run the harness #[cfg(feature = "sancov_ctx")] #[derive(Debug, Clone, Copy)] -pub struct CtxHook { - phantom: PhantomData, +pub struct CtxHook { + phantom: PhantomData<(I, S)>, } #[cfg(feature = "sancov_ctx")] -impl CtxHook -where - S: libafl::inputs::UsesInput, +impl CtxHook { /// The constructor for this struct #[must_use] @@ -109,9 +105,7 @@ where } #[cfg(feature = "sancov_ctx")] -impl Default for CtxHook -where - S: libafl::inputs::UsesInput, +impl Default for CtxHook { fn default() -> Self { Self::new() @@ -120,12 +114,10 @@ where #[cfg(any(feature = "sancov_ngram4", feature = "sancov_ngram8"))] #[rustversion::nightly] -impl ExecutorHook for NgramHook -where - S: libafl::inputs::UsesInput, +impl ExecutorHook for NgramHook { fn init(&mut self, _state: &mut S) {} - fn pre_exec(&mut self, _state: &mut S, _input: &S::Input) { + fn pre_exec(&mut self, _state: &mut S, _input: &I) { #[cfg(feature = "sancov_ngram4")] unsafe { PREV_ARRAY_4 = Ngram4::from_array([0, 0, 0, 0]); @@ -136,14 +128,12 @@ where PREV_ARRAY_8 = Ngram8::from_array([0, 0, 0, 0, 0, 0, 0, 0]); } } - fn post_exec(&mut self, _state: &mut S, _input: &S::Input) {} + fn post_exec(&mut self, _state: &mut S, _input: &I) {} } #[cfg(any(feature = "sancov_ngram4", feature = "sancov_ngram8"))] #[rustversion::nightly] -impl NgramHook -where - S: libafl::inputs::UsesInput, +impl NgramHook { /// The constructor for this struct #[must_use] @@ -156,9 +146,7 @@ where #[cfg(any(feature = "sancov_ngram4", feature = "sancov_ngram8"))] #[rustversion::nightly] -impl Default for NgramHook -where - S: libafl::inputs::UsesInput, +impl Default for NgramHook { fn default() -> Self { Self::new() @@ -166,17 +154,15 @@ where } #[cfg(feature = "sancov_ctx")] -impl ExecutorHook for CtxHook -where - S: libafl::inputs::UsesInput, +impl ExecutorHook for CtxHook { fn init(&mut self, _state: &mut S) {} - fn pre_exec(&mut self, _state: &mut S, _input: &S::Input) { + fn pre_exec(&mut self, _state: &mut S, _input: &I) { unsafe { __afl_prev_ctx = 0; } } - fn post_exec(&mut self, _state: &mut S, _input: &S::Input) {} + fn post_exec(&mut self, _state: &mut S, _input: &I) {} } #[rustversion::nightly]