Parcourir la source

Merge pull request #400 from randy408/fuzz

OSS-Fuzz: build with $CXX
Alanscut il y a 5 ans
Parent
commit
f589f81a42
2 fichiers modifiés avec 9 ajouts et 2 suppressions
  1. 8 0
      fuzzing/cjson_read_fuzzer.c
  2. 1 2
      fuzzing/ossfuzz.sh

+ 8 - 0
fuzzing/cjson_read_fuzzer.c

@@ -2,6 +2,10 @@
 #include <stdint.h>
 #include <string.h>
 
+#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

+ 1 - 2
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