aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergej Schumilo <sergej@schumilo.de>2023-04-14 06:24:46 +0200
committerSergej Schumilo <sergej@schumilo.de>2023-04-14 06:24:46 +0200
commitc34c3e2f5f70d9a445bdbbb2e2f0937e98358607 (patch)
tree2e1ea4137f0450ee6287b0804633f2a2c667f8e0 /src
parent4f6ec6cb081bfee7a6e1d6ac211b33a820ec2f71 (diff)
downloadafl++-c34c3e2f5f70d9a445bdbbb2e2f0937e98358607.tar.gz
add some sanity checks and remove duplicate nyx_shutdown calls
Diffstat (limited to 'src')
-rw-r--r--src/afl-forkserver.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c
index 7eb2155e..ae2adc3d 100644
--- a/src/afl-forkserver.c
+++ b/src/afl-forkserver.c
@@ -555,14 +555,12 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
switch (fsrv->nyx_handlers->nyx_exec(fsrv->nyx_runner)) {
case Abort:
- fsrv->nyx_handlers->nyx_shutdown(fsrv->nyx_runner);
FATAL("Error: Nyx abort occured...");
break;
case IoError:
FATAL("Error: QEMU-Nyx has died...");
break;
case Error:
- fsrv->nyx_handlers->nyx_shutdown(fsrv->nyx_runner);
FATAL("Error: Nyx runtime error has occured...");
break;
default:
@@ -1293,8 +1291,14 @@ void afl_fsrv_kill(afl_forkserver_t *fsrv) {
#ifdef __linux__
if (fsrv->nyx_mode) {
- free(fsrv->nyx_aux_string);
- fsrv->nyx_handlers->nyx_shutdown(fsrv->nyx_runner);
+ if (fsrv->nyx_aux_string){
+ free(fsrv->nyx_aux_string);
+ }
+
+ /* check if we actually got a valid nyx runner */
+ if (fsrv->nyx_runner) {
+ fsrv->nyx_handlers->nyx_shutdown(fsrv->nyx_runner);
+ }
}
@@ -1474,7 +1478,6 @@ afl_fsrv_run_target(afl_forkserver_t *fsrv, u32 timeout,
FATAL("FixMe: Nyx InvalidWriteToPayload handler is missing");
break;
case Abort:
- fsrv->nyx_handlers->nyx_shutdown(fsrv->nyx_runner);
FATAL("Error: Nyx abort occured...");
case IoError:
if (*stop_soon_p) {