From 0d3d65ba2818239c269f47b95ee8d4c1da75bc9c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 17 May 2020 14:31:24 +0200 Subject: [PATCH] :wrench: Fuzzit --- scripts/fuzzer.c | 3 +-- src/gwion.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/fuzzer.c b/scripts/fuzzer.c index ee1b02ef..3f207681 100644 --- a/scripts/fuzzer.c +++ b/scripts/fuzzer.c @@ -21,10 +21,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { push_global(&gwion, "[afl]"); m_str str = mp_calloc2(gwion.mp, Size + 1); memcpy(str, Data, Size); - str[Size] = '\0'; if(compile_string(&gwion, "libfuzzer", str)) gwion_run(&gwion); - pop_global(&gwion); mp_free2(gwion.mp, Size + 1, str); + pop_global(&gwion); return 0; } diff --git a/src/gwion.c b/src/gwion.c index d1f0e336..df4abb90 100644 --- a/src/gwion.c +++ b/src/gwion.c @@ -151,8 +151,8 @@ ANN static void env_header(const Env env) { ANN void env_err(const Env env, const loc_t pos, const m_str fmt, ...) { if(env->context && env->context->error) - return; -#ifndef __AFL_HAVE_MANUAL_CONTROL + return; +#ifndef __FUZZING__ env_header(env); loc_header(pos, env->name); va_list arg; -- 2.43.0