File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -482,7 +482,11 @@ where
482482 } ;
483483 let cur = current_time ( ) ;
484484 // default to 0 here to avoid crashes on clock skew
485- if cur. saturating_sub ( * last_report_time) > monitor_timeout {
485+ if cur
486+ . checked_sub ( * last_report_time)
487+ . unwrap_or ( monitor_timeout)
488+ >= monitor_timeout
489+ {
486490 // report_progress sets a new `last_report_time` internally.
487491 reporter. report_progress ( state) ?;
488492 }
Original file line number Diff line number Diff line change @@ -203,8 +203,10 @@ impl ClientStats {
203203 /// We got new information about executions for this client, insert them.
204204 #[ cfg( feature = "afl_exec_sec" ) ]
205205 pub fn update_executions ( & mut self , executions : u64 , cur_time : Duration ) {
206- let diff = cur_time. saturating_sub ( self . last_window_time ) . as_secs ( ) ;
207- if diff > CLIENT_STATS_TIME_WINDOW_SECS {
206+ let diff = cur_time
207+ . checked_sub ( self . last_window_time )
208+ . map_or ( CLIENT_STATS_TIME_WINDOW_SECS , |d| d. as_secs ( ) ) ;
209+ if diff >= CLIENT_STATS_TIME_WINDOW_SECS {
208210 let _: f64 = self . execs_per_sec ( cur_time) ;
209211 self . last_window_time = cur_time;
210212 self . last_window_executions = self . executions ;
You can’t perform that action at this time.
0 commit comments