From e7578305d610fa11d3e8ea828b7cfdee68a29e5b Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Tue, 27 Oct 2020 21:07:55 +0100 Subject: [PATCH] current inmemory executor static var (not working) --- src/executors/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/executors/mod.rs b/src/executors/mod.rs index a02d34c328..e61bb2536c 100644 --- a/src/executors/mod.rs +++ b/src/executors/mod.rs @@ -34,14 +34,19 @@ pub struct InMemoryExecutor { } +static mut CURRENT_INMEMORY_EXECUTOR: Option<&InMemoryExecutor> = None; + impl Executor for InMemoryExecutor { fn run_target(&mut self) -> Result { let bytes = self.base.cur_input.serialize(); - return match bytes { + unsafe { CURRENT_INMEMORY_EXECUTOR = Some(self); } + let outcome = match bytes { Ok(b) => Ok((self.harness)(self, b)), Err(e) => Err(e) - } + }; + unsafe { CURRENT_INMEMORY_EXECUTOR = None; } + outcome } fn place_input(&mut self, input: Box) -> Result<(), AflError> {