From 0b3f6d6aab5fae0fdde00e0ce82573b08b170fd0 Mon Sep 17 00:00:00 2001 From: cpq Date: Fri, 30 Sep 2022 11:44:50 +0100 Subject: [PATCH] Use CC for fuzzer, not CXX --- Makefile | 3 +-- test/fuzz.c | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 91e272e1..5ab3dacf 100644 --- a/Makefile +++ b/Makefile @@ -75,10 +75,9 @@ musl: RUN = $(DOCKER) mdashnet/cc1 unamalgamated: $(HDRS) Makefile test/packed_fs.c $(CC) src/*.c test/packed_fs.c test/unit_test.c $(CFLAGS) $(LDFLAGS) -g -o unit_test -fuzz: WARN += -Wno-deprecated -Wno-vla-extension fuzz: ASAN = -fsanitize=fuzzer,signed-integer-overflow,address,undefined fuzz: mongoose.c mongoose.h Makefile test/fuzz.c - $(CXX) test/fuzz.c $(OPTS) $(WARN) $(INCS) $(TFLAGS) $(ASAN) -o fuzzer + $(CC) test/fuzz.c $(OPTS) $(WARN) $(INCS) $(TFLAGS) $(ASAN) -o fuzzer $(RUN) ./fuzzer fuzz2: mongoose.c mongoose.h Makefile test/fuzz.c diff --git a/test/fuzz.c b/test/fuzz.c index 6974284e..df9bc033 100644 --- a/test/fuzz.c +++ b/test/fuzz.c @@ -88,12 +88,16 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { #if defined(MAIN) int main(int argc, char *argv[]) { + int res = EXIT_FAILURE; if (argc > 1) { size_t len = 0; char *buf = mg_file_read(&mg_fs_posix, argv[1], &len); - if (buf != NULL) LLVMFuzzerTestOneInput((uint8_t *) buf, len); + if (buf != NULL) { + LLVMFuzzerTestOneInput((uint8_t *) buf, len); + res = EXIT_SUCCESS; + } free(buf); } - return 0; + return res; } #endif