From 8b912a8ce1dc8db658a3f5f1246484807b5318db Mon Sep 17 00:00:00 2001 From: Alex Groce Date: Sun, 2 Dec 2018 20:34:19 -0700 Subject: [PATCH] allow abort in libfuzzer --- src/lib/DeepState.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/DeepState.c b/src/lib/DeepState.c index 26c9fee..91bbfc4 100644 --- a/src/lib/DeepState.c +++ b/src/lib/DeepState.c @@ -601,6 +601,13 @@ extern int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { enum DeepState_TestRunResult result = DeepState_RunTestLLVM(test); + const char* abort_check = getenv("LIBFUZZER_ABORT_ON_FAIL"); + if (abort_check != NULL) { + if ((result == DeepState_TestRunFail) || (result == DeepState_TestRunCrash)) { + abort(); + } + } + DeepState_Teardown(); DeepState_CurrentTestRun = NULL; free(mem);