aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2021-03-06 02:51:44 +0000
committerTatsuya Kinoshita <tats@debian.org>2021-03-06 02:51:44 +0000
commit593d4adcb00c4d19da45f3f6ad3f319bd3e5901d (patch)
treeef0bd221fb442da4af9d29dd76bcb7bfa41c4b73
parentMerge pull request #174 from bptato/master (diff)
downloadw3m-593d4adcb00c4d19da45f3f6ad3f319bd3e5901d.tar.gz
w3m-593d4adcb00c4d19da45f3f6ad3f319bd3e5901d.zip
Call GC_INIT() in fuzzing
-rw-r--r--fuzz/fuzz-conv.c8
1 files changed, 8 insertions, 0 deletions
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 <stdint.h>
#include <string.h>
#include <stdlib.h>
+#include <gc.h>
#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;
}