From b0038da8485bb98e4ef0c3a2421f4faaf9d88378 Mon Sep 17 00:00:00 2001 From: xingyaner Date: Sun, 2 Aug 2026 18:13:34 +0800 Subject: [PATCH] Fix OSS-Fuzz fuzzer build: memcheck/expr_exit defaults and VM cleanup --- configure.sh | 4 +++- src/bc_fuzzer.c | 1 + src/dc_fuzzer.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.sh b/configure.sh index 4f945292..bd09e9fa 100755 --- a/configure.sh +++ b/configure.sh @@ -949,7 +949,7 @@ if [ "$karatsuba_len" -lt 16 ]; then fi if [ "$ossfuzz" -ne 0 ] && [ "$memcheck" -eq 0 ]; then - usage "Can only enable OSSFUZZ when MEMCHECK is enabled" + memcheck=1 fi set -e @@ -1180,6 +1180,8 @@ if [ "$fuzz" -ne 0 ] || [ "$ossfuzz" -ne 0 ]; then hist=0 nls=0 optimization="3" + bc_default_expr_exit=0 + dc_default_expr_exit=0 fi # This sets some necessary things for debug mode. diff --git a/src/bc_fuzzer.c b/src/bc_fuzzer.c index cd00a25b..54d7104e 100644 --- a/src/bc_fuzzer.c +++ b/src/bc_fuzzer.c @@ -104,6 +104,7 @@ LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) exit: BC_SIG_MAYLOCK; + s = bc_vm_atexit(s); free(bc_fuzzer_data); diff --git a/src/dc_fuzzer.c b/src/dc_fuzzer.c index 7e3e7df5..5bbf24a5 100644 --- a/src/dc_fuzzer.c +++ b/src/dc_fuzzer.c @@ -104,6 +104,7 @@ LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) exit: BC_SIG_MAYLOCK; + s = bc_vm_atexit(s); free(bc_fuzzer_data);