Skip to content

Commit

Permalink
Merge pull request #269 from chaoticgd/update_fuzzer
Browse files Browse the repository at this point in the history
Fix the fuzzing harness
  • Loading branch information
chaoticgd authored Nov 30, 2024
2 parents 4c29990 + 5d4c57f commit d20dc86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
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;
}

0 comments on commit d20dc86

Please sign in to comment.