summaryrefslogtreecommitdiff
path: root/support/cJSON-master/fuzzing/CMakeLists.txt
diff options
context:
space:
mode:
authorlijie <[email protected]>2018-12-18 14:13:02 +0800
committerlijie <[email protected]>2018-12-18 14:13:02 +0800
commita4abef91b597f226f918f506e7ff591a77f3b126 (patch)
treeb16c769bb9ec312b832b28d7315110f7daecc631 /support/cJSON-master/fuzzing/CMakeLists.txt
parentfc99454ea9bce35065e34b28815f8cf417b37804 (diff)
修改包含cjson头文件形式,添加mrl的cjson源码v2.0.0
Diffstat (limited to 'support/cJSON-master/fuzzing/CMakeLists.txt')
-rw-r--r--support/cJSON-master/fuzzing/CMakeLists.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/support/cJSON-master/fuzzing/CMakeLists.txt b/support/cJSON-master/fuzzing/CMakeLists.txt
new file mode 100644
index 0000000..fdd7126
--- /dev/null
+++ b/support/cJSON-master/fuzzing/CMakeLists.txt
@@ -0,0 +1,28 @@
+option(ENABLE_FUZZING "Create executables and targets for fuzzing cJSON with afl." Off)
+if (ENABLE_FUZZING)
+ find_program(AFL_FUZZ afl-fuzz)
+ if ("${AFL_FUZZ}" MATCHES "AFL_FUZZ-NOTFOUND")
+ message(FATAL_ERROR "Couldn't find afl-fuzz.")
+ endif()
+
+ add_executable(afl-main afl.c)
+ target_link_libraries(afl-main "${CJSON_LIB}")
+
+ if (NOT ENABLE_SANITIZERS)
+ message(FATAL_ERROR "Enable sanitizers with -DENABLE_SANITIZERS=On to do fuzzing.")
+ endif()
+
+ option(ENABLE_FUZZING_PRINT "Fuzz printing functions together with parser." On)
+ set(fuzz_print_parameter "no")
+ if (ENABLE_FUZZING_PRINT)
+ set(fuzz_print_parameter "yes")
+ endif()
+
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error")
+
+ add_custom_target(afl
+ COMMAND "${AFL_FUZZ}" -i "${CMAKE_CURRENT_SOURCE_DIR}/inputs" -o "${CMAKE_CURRENT_BINARY_DIR}/findings" -x "${CMAKE_CURRENT_SOURCE_DIR}/json.dict" -- "${CMAKE_CURRENT_BINARY_DIR}/afl-main" "@@" "${fuzz_print_parameter}"
+ DEPENDS afl-main)
+
+
+endif()