From 73b0e739d0cfc7036ef36c2736970032605eb6c7 Mon Sep 17 00:00:00 2001 From: Randy Date: Tue, 22 Oct 2019 13:32:41 +0200 Subject: [PATCH 1/2] fuzz: add support for compiling with c++ compiler --- fuzzing/cjson_read_fuzzer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fuzzing/cjson_read_fuzzer.c b/fuzzing/cjson_read_fuzzer.c index b2692ed..e9f733d 100644 --- a/fuzzing/cjson_read_fuzzer.c +++ b/fuzzing/cjson_read_fuzzer.c @@ -2,6 +2,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #include "../cJSON.h" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); /* required by C89 */ @@ -66,3 +70,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) return 0; } + +#ifdef __cplusplus +} +#endif \ No newline at end of file From 49a0ede475c9042a868f15718fad911f7423597a Mon Sep 17 00:00:00 2001 From: Randy Date: Tue, 22 Oct 2019 13:37:41 +0200 Subject: [PATCH 2/2] ossfuzz: build with c++ compiler --- fuzzing/ossfuzz.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fuzzing/ossfuzz.sh b/fuzzing/ossfuzz.sh index fe4bf16..a2da64b 100755 --- a/fuzzing/ossfuzz.sh +++ b/fuzzing/ossfuzz.sh @@ -8,8 +8,7 @@ cd build cmake -DBUILD_SHARED_LIBS=OFF -DENABLE_CJSON_TEST=OFF .. make -j$(nproc) -$CC $CFLAGS -std=c89 -I. \ - $SRC/cjson/fuzzing/cjson_read_fuzzer.c \ +$CXX $CXXFLAGS $SRC/cjson/fuzzing/cjson_read_fuzzer.c -I. \ -o $OUT/cjson_read_fuzzer \ $LIB_FUZZING_ENGINE $SRC/cjson/build/libcjson.a