From 593d4adcb00c4d19da45f3f6ad3f319bd3e5901d Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Sat, 6 Mar 2021 11:51:44 +0900 Subject: Call GC_INIT() in fuzzing --- fuzz/fuzz-conv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fuzz/fuzz-conv.c b/fuzz/fuzz-conv.c index 5817e5d..b067378 100644 --- a/fuzz/fuzz-conv.c +++ b/fuzz/fuzz-conv.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "wc.h" char *get_null_terminated(const uint8_t *data, size_t size) { @@ -14,6 +15,13 @@ char *get_null_terminated(const uint8_t *data, size_t size) { } int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size){ + static int init_done = 0; + + if (!init_done) { + GC_INIT(); + init_done = 1; + } + if (size < 30) { return 0; } -- cgit v1.2.3