@@ -2517,7 +2517,7 @@ fn fuzz(
25172517
25182518 // In-process crashes abort the fuzzing instance, and the restarting manager respawns it.
25192519 // Implement `go test -fuzz` semantics: stop the whole run on the first crash.
2520- if stop_all_fuzzers_on_panic && count_crash_inputs ( & crashes_dir) > initial_crash_inputs {
2520+ if stop_all_fuzzers_on_panic && count_crash_inputs ( & crashes_dir) > 0 {
25212521 restarting_mgr. send_exiting ( ) ?;
25222522 return Err ( Error :: shutting_down ( ) ) ;
25232523 }
@@ -2959,7 +2959,7 @@ fn fuzz(
29592959 && last_global_stop_poll. elapsed( ) >= global_stop_poll_interval
29602960 {
29612961 last_global_stop_poll = Instant :: now( ) ;
2962- if count_crash_inputs( & crashes_dir) > initial_crash_inputs
2962+ if count_crash_inputs( & crashes_dir) > 0
29632963 || ( catch_hangs
29642964 && count_hang_inputs( & hangs_dir) > initial_hang_inputs)
29652965 {
@@ -3055,7 +3055,7 @@ fn fuzz(
30553055 && last_global_stop_poll. elapsed( ) >= global_stop_poll_interval
30563056 {
30573057 last_global_stop_poll = Instant :: now( ) ;
3058- if count_crash_inputs( & crashes_dir) > initial_crash_inputs
3058+ if count_crash_inputs( & crashes_dir) > 0
30593059 || ( catch_hangs
30603060 && count_hang_inputs( & hangs_dir) > initial_hang_inputs)
30613061 {
@@ -3167,7 +3167,7 @@ fn fuzz(
31673167 && last_global_stop_poll. elapsed( ) >= global_stop_poll_interval
31683168 {
31693169 last_global_stop_poll = Instant :: now( ) ;
3170- if count_crash_inputs( & crashes_dir) > initial_crash_inputs
3170+ if count_crash_inputs( & crashes_dir) > 0
31713171 || ( catch_hangs
31723172 && count_hang_inputs( & hangs_dir) > initial_hang_inputs)
31733173 {
@@ -3341,7 +3341,11 @@ fn fuzz(
33413341 } ;
33423342 let new_crashes = crash_inputs. len ( ) . saturating_sub ( initial_crash_inputs) ;
33433343
3344- if new_hangs > 0 || new_crashes > 0 {
3344+ let any_crashes = !crash_inputs. is_empty ( ) ;
3345+ if new_hangs > 0
3346+ || new_crashes > 0
3347+ || ( stop_all_fuzzers_on_panic && any_crashes)
3348+ {
33453349 if !is_launcher_client {
33463350 if new_hangs > 0 {
33473351 eprintln ! ( "Found {new_hangs} hanging input(s)." ) ;
@@ -3373,8 +3377,13 @@ fn fuzz(
33733377 }
33743378 }
33753379
3376- if new_crashes > 0 {
3377- eprintln ! ( "Found {new_crashes} crashing input(s)." ) ;
3380+ if new_crashes > 0 || ( stop_all_fuzzers_on_panic && any_crashes) {
3381+ let n = if new_crashes > 0 {
3382+ new_crashes
3383+ } else {
3384+ crash_inputs. len ( )
3385+ } ;
3386+ eprintln ! ( "Found {n} crashing input(s)." ) ;
33783387 eprintln ! ( "libafl output dir: {}" , output. display( ) ) ;
33793388 eprintln ! ( "crashes dir: {}" , crashes_dir. display( ) ) ;
33803389
@@ -3384,7 +3393,7 @@ fn fuzz(
33843393 . and_then ( |m| m. modified ( ) )
33853394 . unwrap_or ( std:: time:: SystemTime :: UNIX_EPOCH )
33863395 } ) ;
3387- for p in sorted. iter ( ) . rev ( ) . take ( new_crashes ) {
3396+ for p in sorted. iter ( ) . rev ( ) . take ( n ) {
33883397 eprintln ! ( "crash input: {}" , p. display( ) ) ;
33893398 if let Ok ( exe) = env:: current_exe ( ) {
33903399 eprintln ! ( "repro: {} run --input {}" , exe. display( ) , p. display( ) ) ;
@@ -3398,7 +3407,7 @@ fn fuzz(
33983407 ) ;
33993408 }
34003409
3401- if stop_all_fuzzers_on_panic {
3410+ if stop_all_fuzzers_on_panic && ( new_hangs > 0 || any_crashes ) {
34023411 notify_restarting_mgr_exit ( ) ;
34033412 std:: process:: exit ( 1 ) ;
34043413 }
0 commit comments