Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ target_include_directories(tests PUBLIC src/)
target_link_libraries(tests ccc ccc_platform ccc_versioninfo demanglegnu gtest)
add_test(NAME tests COMMAND tests ${CMAKE_SOURCE_DIR}/testdata)

if(FUZZ)
if(ENABLE_FUZZ_TESTING)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_executable(fuzztest src/fuzztest.cpp)
target_compile_options(fuzztest PUBLIC -fsanitize=fuzzer)
target_link_options(fuzztest PUBLIC -fsanitize=fuzzer)
target_compile_options(fuzztest PUBLIC -fsanitize=fuzzer,address,signed-integer-overflow)
target_link_options(fuzztest PUBLIC -fsanitize=fuzzer,address,signed-integer-overflow)
target_link_libraries(fuzztest ccc ccc_platform ccc_versioninfo demanglegnu)
else()
message(FATAL_ERROR "The FUZZ option only supports clang.")
message(FATAL_ERROR "The ENABLE_FUZZ_TESTING option only supports clang.")
endif()
endif()

Expand Down
4 changes: 3 additions & 1 deletion src/fuzztest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ extern "C" int LLVMFuzzerTestOneInput(const u8* data, size_t size)

Result<ModuleHandle> module_handle = import_symbol_tables(
database,
(*symbol_file)->name(),
*symbol_tables,
(*symbol_file)->name(),
Address(),
NO_IMPORTER_FLAGS,
demangler,
nullptr);
static_cast<void>(module_handle);

return 0;
}