Skip to content

Commit 4beac80

Browse files
authored
Fix fuzzing build (#250)
Fixes issues with OSS-Fuzz.
1 parent 484a2f0 commit 4beac80

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,5 +249,7 @@ if(OJPH_BUILD_FUZZER)
249249
message(FATAL_ERROR "Fuzzing requires a Clang toolchain.")
250250
endif()
251251

252+
message(STATUS "Building fuzzer target")
253+
252254
add_subdirectory(fuzzing)
253255
endif()

docs/fuzzing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ podman build -t openjph-fuzz -f fuzzing/Dockerfile
77
podman run -it --rm -v $(pwd):/app/ojph/ openjph-fuzz bash
88
image# mkdir /app/build/
99
image# cd /app/build/
10-
image# cmake /app/ojph -DOJPH_BUILD_FUZZER=ON -DBUILD_SHARED_LIBS=OFF
10+
image# cmake /app/ojph -DCMAKE_CXX_FLAGS="-fsanitize=fuzzer,address" -DOJPH_BUILD_FUZZER=ON -DBUILD_SHARED_LIBS=OFF
1111
image# make
1212
image# ./fuzzing/ojph_expand_fuzz_target /app/jp2k_test_codestreams/openjph/*.j2c
1313
```

fuzzing/CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
if(DEFINED ENV{BUILD_UID})
2-
link_libraries($ENV{LIB_FUZZING_ENGINE})
3-
else()
4-
add_compile_options(-fsanitize=fuzzer,address)
5-
add_link_options(-fsanitize=fuzzer,address)
6-
endif()
1+
link_libraries($ENV{LIB_FUZZING_ENGINE})
72

83
add_executable(ojph_expand_fuzz_target fuzz_targets/ojph_expand_fuzz_target.cpp)
94
target_link_libraries(ojph_expand_fuzz_target PRIVATE openjph)
10-

0 commit comments

Comments
 (0)