From 99caeadd5ce2c23f5990e123613c0a161d24a5d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Thu, 7 May 2020 00:52:18 +0200 Subject: [PATCH] :art: Improve afl-fast build --- src/main.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main.c b/src/main.c index d08ae840..597130d2 100644 --- a/src/main.c +++ b/src/main.c @@ -17,29 +17,26 @@ static void sig(int unused NUSED) { #ifdef __AFL_HAVE_MANUAL_CONTROL -ANN static void gwion_reset(const Gwion gwion) { - pop_global(gwion); - push_global(gwion, "[user]"); -} - -#define BUFSIZE 64 +#define BUFSIZE 256 static void afl_run(const Gwion gwion) { char buf[BUFSIZE]; struct GwText_ text = { .mp=gwion->mp }; - while (__AFL_LOOP(5)) { + while (__AFL_LOOP(128)) { ssize_t sz; memset(buf, 0, BUFSIZE); while((sz = read(0, buf, BUFSIZE)) > 0) { buf[sz] = '\0'; text_add(&text, buf); } - if(compile_string(gwion, "afl", text.str)) + if(compile_string(gwion, "afl", text.str)) { + push_global(gwion, "[afl]"); gwion_run(gwion); + pop_global(gwion); + } text_reset(&text); - gwion_reset(gwion); } - text_release(&text); + text_release(&text); } #define gwion_run(a) afl_run(a) #endif -- 2.43.0