Files
coturn/fuzzing/CMakeLists.txt
Pavel Punsky c8b3dd6513 Merge 10 fuzz targets into FuzzStun and FuzzStunClient via dispatcher (#1873)
Upstream OSS-Fuzz build recipe
(google/oss-fuzz/projects/coturn/build.sh) only copies two fuzzer
binaries -- FuzzStun and FuzzStunClient -- and their seed corpora into
$OUT. The eight additional fuzz targets added later never ran on
oss-fuzz.com, which is why the introspector profile reports "fuzzer no
longer available" for them.

Rather than patching the Google-owned build recipe, fold all fuzzers
into the two binaries OSS-Fuzz actually ships. Each target now begins
with a single-byte selector (Data[0] mod 5) that dispatches to one of
five sub-harnesses:

  FuzzStun        - integrity (SHA1/multi-SHA), attr_iter, attr_add,
                    old_stun
  FuzzStunClient  - stun_client, channel_data, addr_codec, oauth_token,
                    oauth_roundtrip

No upstream OSS-Fuzz changes are required.
2026-04-19 13:00:19 -07:00

30 lines
1.1 KiB
CMake

set(FUZZ_COMMON_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/FuzzOpenSSLInit.c
)
# Only two fuzz targets are produced because the upstream OSS-Fuzz build
# recipe (google/oss-fuzz/projects/coturn/build.sh) copies only these two
# binaries and their seed corpora into $OUT. Additional fuzzing coverage is
# reached by dispatching from a single-byte selector inside each target.
add_executable(FuzzStun FuzzStun.c ${FUZZ_COMMON_SOURCES})
target_link_libraries(FuzzStun turnclient ${LIB_FUZZING_ENGINE})
set(FuzzStunClientSRC
${CMAKE_CURRENT_SOURCE_DIR}/FuzzStunClient.c
${PROJECT_SOURCE_DIR}/src/apps/common/stun_buffer.c
)
add_executable(FuzzStunClient ${FuzzStunClientSRC} ${FUZZ_COMMON_SOURCES})
target_link_libraries(FuzzStunClient turnclient ${LIB_FUZZING_ENGINE})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/input/FuzzStun_seed_corpus.zip
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/input/FuzzStunClient_seed_corpus.zip
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
# Shared dictionary for STUN/TURN fuzz targets
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/stun.dict
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})