current inmemory executor static var (not working)

This commit is contained in:
Andrea Fioraldi 2020-10-27 21:07:55 +01:00
parent ce9413bfa4
commit e7578305d6

View File

@ -34,14 +34,19 @@ pub struct InMemoryExecutor {
} }
static mut CURRENT_INMEMORY_EXECUTOR: Option<&InMemoryExecutor> = None;
impl Executor for InMemoryExecutor { impl Executor for InMemoryExecutor {
fn run_target(&mut self) -> Result<ExitKind, AflError> { fn run_target(&mut self) -> Result<ExitKind, AflError> {
let bytes = self.base.cur_input.serialize(); 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)), Ok(b) => Ok((self.harness)(self, b)),
Err(e) => Err(e) Err(e) => Err(e)
} };
unsafe { CURRENT_INMEMORY_EXECUTOR = None; }
outcome
} }
fn place_input(&mut self, input: Box<dyn Input>) -> Result<(), AflError> { fn place_input(&mut self, input: Box<dyn Input>) -> Result<(), AflError> {