From d6317d84241c37896007d9668cce5bd07274a0d9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 18 May 2020 17:58:08 +0200 Subject: [PATCH] :wrench: Update fuzzer --- scripts/fuzzer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/fuzzer.c b/scripts/fuzzer.c index 3f207681..04875883 100644 --- a/scripts/fuzzer.c +++ b/scripts/fuzzer.c @@ -8,7 +8,6 @@ #include "compile.h" static struct Gwion_ gwion; - static void initialize() { Arg arg = { .loop=-1 }; const m_bool ini = gwion_ini(&gwion, &arg); @@ -21,8 +20,14 @@ 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); - if(compile_string(&gwion, "libfuzzer", str)) + if(compile_string(&gwion, "libfuzzer", str)) { gwion_run(&gwion); + if(vector_size(&gwion.env->scope->known_ctx)) { + Context ctx = (Context)vector_pop(&gwion.env->scope->known_ctx); + if(!ctx->global) + REM_REF(ctx, &gwion); + } + } mp_free2(gwion.mp, Size + 1, str); pop_global(&gwion); return 0; -- 2.43.0