From 91b8b5b8d149a19e17e450531db158361394c472 Mon Sep 17 00:00:00 2001 From: Alex Groce Date: Thu, 3 Jan 2019 15:02:59 -0700 Subject: [PATCH] Fix the mac OS abort problem with libFuzzer --- src/include/deepstate/DeepState.h | 4 ++-- src/lib/DeepState.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/include/deepstate/DeepState.h b/src/include/deepstate/DeepState.h index c6d5d83..227cb17 100644 --- a/src/include/deepstate/DeepState.h +++ b/src/include/deepstate/DeepState.h @@ -724,7 +724,7 @@ static int DeepState_RunSingleSavedTestCase(void) { if ((result == DeepState_TestRunFail) || (result == DeepState_TestRunCrash)) { if (FLAGS_abort_on_fail) { - abort(); + assert(0); // Terminate in a way AFL/etc. can see as a crash } num_failed_tests++; } @@ -790,7 +790,7 @@ static int DeepState_RunSingleSavedTestDir(void) { if ((result == DeepState_TestRunFail) || (result == DeepState_TestRunCrash)) { if (FLAGS_abort_on_fail) { - abort(); + assert(0); // Terminate in a way AFL/etc. can see as a crash } num_failed_tests++; diff --git a/src/lib/DeepState.c b/src/lib/DeepState.c index 48c0c3d..a62395a 100644 --- a/src/lib/DeepState.c +++ b/src/lib/DeepState.c @@ -741,7 +741,7 @@ enum DeepState_TestRunResult DeepState_FuzzOneTestCase(struct DeepState_TestInfo if (FLAGS_abort_on_fail && ((result == DeepState_TestRunCrash) || (result == DeepState_TestRunFail))) { - abort(); + assert(0); // Terminate the testing in a way AFL/etc. can see as a crash } return result; @@ -783,7 +783,7 @@ extern int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { const char* abort_check = getenv("LIBFUZZER_ABORT_ON_FAIL"); if (abort_check != NULL) { if ((result == DeepState_TestRunFail) || (result == DeepState_TestRunCrash)) { - abort(); + assert(0); // Terminate the testing more permanently } }