aboutsummaryrefslogtreecommitdiffstats
path: root/fuzz/fuzz-conv.c
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/fuzz-conv.c')
-rw-r--r--fuzz/fuzz-conv.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fuzz/fuzz-conv.c b/fuzz/fuzz-conv.c
index b067378..3e85f86 100644
--- a/fuzz/fuzz-conv.c
+++ b/fuzz/fuzz-conv.c
@@ -14,11 +14,21 @@ char *get_null_terminated(const uint8_t *data, size_t size) {
return new_str;
}
+static void *die_oom(size_t bytes) {
+ fprintf(stderr, "Out of memory: %lu bytes unavailable!\n", (unsigned long)bytes);
+ exit(1);
+}
+
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size){
static int init_done = 0;
if (!init_done) {
GC_INIT();
+#if (GC_VERSION_MAJOR>7) || ((GC_VERSION_MAJOR==7) && (GC_VERSION_MINOR>=2))
+ GC_set_oom_fn(die_oom);
+#else
+ GC_oom_fn = die_oom;
+#endif
init_done = 1;
}