From ad9a2faaea4e03a57b29eadabdebab1cbd73a5b3 Mon Sep 17 00:00:00 2001 From: Gal Tashma Date: Tue, 1 Jun 2021 19:02:27 +0300 Subject: [PATCH] don't panick on time subtraction failure (#141) On some machines, the system clock can be faulty and start_time maybe actually be after the end time. This causes a panic, instead gracefully just put a None time in `self.last_runtime` --- libafl/src/observers/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libafl/src/observers/mod.rs b/libafl/src/observers/mod.rs index 803603fce7..b5804b7c8c 100644 --- a/libafl/src/observers/mod.rs +++ b/libafl/src/observers/mod.rs @@ -90,7 +90,7 @@ impl HasExecHooks for TimeObserver { _mgr: &mut EM, _input: &I, ) -> Result<(), Error> { - self.last_runtime = Some(current_time() - self.start_time); + self.last_runtime = current_time().checked_sub(self.start_time); Ok(()) } }