From e4a584c02aef0270b8364b865f189f672319d66e Mon Sep 17 00:00:00 2001 From: toka Date: Tue, 16 Mar 2021 19:20:40 +0900 Subject: [PATCH] pass Duration and move timeout stuff to post_exec --- libafl/src/executors/inprocess.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/libafl/src/executors/inprocess.rs b/libafl/src/executors/inprocess.rs index b7247617e7..ef273a755d 100644 --- a/libafl/src/executors/inprocess.rs +++ b/libafl/src/executors/inprocess.rs @@ -241,10 +241,10 @@ where I: Input + HasTargetBytes, OT: ObserversTuple, { - pub fn new(executor: EX, exec_tmout: u64) -> Self { + pub fn new(executor: EX, exec_tmout: Duration) -> Self { Self { executor, - exec_tmout: Duration::from_secs(exec_tmout), + exec_tmout, phantom: PhantomData, } } @@ -285,8 +285,13 @@ where self.executor.pre_exec(_state, _event_mgr, _input) } - fn run_target(&mut self, input: &I) -> Result { - let run_result = self.executor.run_target(input); + #[inline] + fn post_exec, S>( + &mut self, + _state: &S, + _event_mgr: &mut EM, + _input: &I, + ) -> Result<(), Error> { unsafe { let it_value = Timeval { tv_sec: 0, @@ -305,7 +310,11 @@ where null_mut(), ); } - run_result + self.executor.post_exec(_state, _event_mgr, _input) + } + + fn run_target(&mut self, input: &I) -> Result{ + self.executor.run_target(input) } }