File tree Expand file tree Collapse file tree 4 files changed +17
-16
lines changed
Expand file tree Collapse file tree 4 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -238,5 +238,13 @@ install(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc"
238238if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND OJPH_BUILD_TESTS)
239239 enable_testing ()
240240 add_subdirectory (tests)
241+ endif ()
242+
243+ ################################################################################################
244+ # Testing and fuzzing (OJPH_BUILD_FUZZER)
245+ ################################################################################################
246+
247+ if (OJPH_BUILD_FUZZER)
241248 add_subdirectory (fuzzing)
242249endif ()
250+
Original file line number Diff line number Diff line change 11# Fuzzer Target #
22
3- Fuzzer targets can be build using the ` OJPH_BUILD_FUZZER ` build option. The Dockerfile in the ` fuzzing directory ` allows local testing:
3+ Fuzzer targets intended for use with [ oss-fuzz] ( https://oss-fuzz.com/ ) can be build using the ` OJPH_BUILD_FUZZER ` build option.
4+
5+ The targets can be run locally as follows:
46
57``` sh
6- podman build -t openjph-fuzz -f fuzzing/Dockerfile
7- podman run -it --rm -v $( pwd) :/app/ojph/ openjph-fuzz bash
8- image# mkdir /app/build/
9- image# cd /app/build/
10- image# cmake /app/ojph -DCMAKE_CXX_FLAGS=" -fsanitize=fuzzer,address" -DOJPH_BUILD_FUZZER=ON -DBUILD_SHARED_LIBS=OFF
11- image# make
12- image# ./fuzzing/ojph_expand_fuzz_target /app/jp2k_test_codestreams/openjph/* .j2c
8+ cd build
9+ cmake .. -DOJPH_BUILD_FUZZER=ON
10+ ./fuzzing/ojph_expand_fuzz_target < test case>
1311```
Original file line number Diff line number Diff line change 1+ # detect whether we are within the oss fuzz environment
12if (DEFINED ENV{LIB_FUZZING_ENGINE})
3+ # if yes, we can link against the main function of the fuzzing engine
24 link_libraries ($ENV{LIB_FUZZING_ENGINE} )
35else ()
6+ # if not, we need to define our main function
47 add_compile_definitions (OJPH_FUZZ_TARGET_MAIN)
58endif ()
69
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments