diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-05-23 00:34:01 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-05-23 06:11:33 +0200 |
commit | 0f2b6345c67f49479799e9c560567c886b1ed2cb (patch) | |
tree | 896fcb9b2e65f92fccb20585c304200a96b63a8d /Userland | |
parent | 9690b4011b250a0c55a534e51f62af1fe1d10b37 (diff) | |
download | serenity-0f2b6345c67f49479799e9c560567c886b1ed2cb.zip |
test-fuzz: Add all the missing fuzzers
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibELF/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Userland/Utilities/CMakeLists.txt | 29 | ||||
-rw-r--r-- | Userland/Utilities/test-fuzz.cpp | 47 |
3 files changed, 54 insertions, 26 deletions
diff --git a/Userland/Libraries/LibELF/CMakeLists.txt b/Userland/Libraries/LibELF/CMakeLists.txt index 351c8f4f18..dbcf3cacf9 100644 --- a/Userland/Libraries/LibELF/CMakeLists.txt +++ b/Userland/Libraries/LibELF/CMakeLists.txt @@ -1 +1,5 @@ +# LibELF is included within LibC on Serenity and defined as a target in a different place for Lagom, +# so add a dummy interface library for platform-agnosticism. +add_library(LibELF INTERFACE) + serenity_install_sources("Userland/Libraries/LibELF") diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index c46e8938d7..89d08be635 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -137,7 +137,6 @@ target_link_libraries(syscall PRIVATE LibSystem) target_link_libraries(ttfdisasm PRIVATE LibGfx) target_link_libraries(tar PRIVATE LibArchive LibCompress LibFileSystem) target_link_libraries(telws PRIVATE LibProtocol LibLine) -target_link_libraries(test-fuzz PRIVATE LibGemini LibGfx LibHTTP LibIPC LibJS LibMarkdown LibRegex LibShell) target_link_libraries(test-imap PRIVATE LibIMAP) target_link_libraries(test-pthread PRIVATE LibThreading) target_link_libraries(touch PRIVATE LibFileSystem) @@ -159,30 +158,12 @@ target_link_libraries(zip PRIVATE LibArchive LibCompress LibCrypto LibFileSystem # FIXME: Link this file into headless-browser without compiling it again. target_sources(headless-browser PRIVATE "${SerenityOS_SOURCE_DIR}/Userland/Services/WebContent/WebDriverConnection.cpp") -function (add_fuzzing_target name) +include("${SerenityOS_SOURCE_DIR}/Meta/Lagom/Fuzzers/fuzzers.cmake") + +foreach(name IN LISTS FUZZER_TARGETS) set(fuzz_source_file "${SerenityOS_SOURCE_DIR}/Meta/Lagom/Fuzzers/Fuzz${name}.cpp") target_sources(test-fuzz PRIVATE "${fuzz_source_file}") set_source_files_properties("${fuzz_source_file}" PROPERTIES COMPILE_DEFINITIONS "LLVMFuzzerTestOneInput=Test${name}") set_source_files_properties("${fuzz_source_file}" PROPERTIES COMPILE_OPTIONS "-Wno-missing-declarations") -endfunction() - -add_fuzzing_target("BMPLoader") -add_fuzzing_target("ELF") -add_fuzzing_target("Gemini") -add_fuzzing_target("GIFLoader") -add_fuzzing_target("HttpRequest") -add_fuzzing_target("ICOLoader") -add_fuzzing_target("JPEGLoader") -add_fuzzing_target("Js") -add_fuzzing_target("Markdown") -add_fuzzing_target("PBMLoader") -add_fuzzing_target("PGMLoader") -add_fuzzing_target("PNGLoader") -add_fuzzing_target("PPMLoader") -add_fuzzing_target("QOILoader") -add_fuzzing_target("TGALoader") -add_fuzzing_target("RegexECMA262") -add_fuzzing_target("RegexPosixExtended") -add_fuzzing_target("Shell") -add_fuzzing_target("TTF") -add_fuzzing_target("URL") + target_link_libraries(test-fuzz PRIVATE "${FUZZER_DEPENDENCIES_${name}}") +endforeach() diff --git a/Userland/Utilities/test-fuzz.cpp b/Userland/Utilities/test-fuzz.cpp index 9ea825f56e..775e4b5236 100644 --- a/Userland/Utilities/test-fuzz.cpp +++ b/Userland/Utilities/test-fuzz.cpp @@ -10,27 +10,70 @@ #include <LibMain/Main.h> #include <unistd.h> +// TODO: Look into generating this from the authoritative list of fuzzing targets in fuzzer.cmake. #define ENUMERATE_TARGETS(T) \ + T(ASN1) \ T(BMPLoader) \ + T(Brotli) \ + T(CSSParser) \ + T(CyrillicDecoder) \ + T(DeflateCompression) \ + T(DeflateDecompression) \ T(ELF) \ + T(FlacLoader) \ T(Gemini) \ T(GIFLoader) \ + T(GzipCompression) \ + T(GzipDecompression) \ + T(HebrewDecoder) \ T(HttpRequest) \ + T(ICCProfile) \ T(ICOLoader) \ + T(IMAPParser) \ T(JPEGLoader) \ T(Js) \ + T(Latin1Decoder) \ + T(Latin2Decoder) \ + T(LzmaDecompression) \ + T(LzmaRoundtrip) \ T(Markdown) \ + T(MatroskaReader) \ + T(MD5) \ + T(MP3Loader) \ T(PBMLoader) \ + T(PDF) \ + T(PEM) \ T(PGMLoader) \ T(PNGLoader) \ + T(Poly1305) \ T(PPMLoader) \ + T(QOALoader) \ T(QOILoader) \ - T(TGALoader) \ + T(QuotedPrintableParser) \ T(RegexECMA262) \ + T(RegexPosixBasic) \ T(RegexPosixExtended) \ + T(RSAKeyParsing) \ + T(SHA1) \ + T(SHA256) \ + T(SHA384) \ + T(SHA512) \ T(Shell) \ + T(ShellPosix) \ + T(SQLParser) \ + T(Tar) \ + T(TGALoader) \ T(TTF) \ - T(URL) + T(URL) \ + T(UTF16BEDecoder) \ + T(VP9Decoder) \ + T(WasmParser) \ + T(WAVLoader) \ + T(WebPLoader) \ + T(WOFF) \ + T(XML) \ + T(Zip) \ + T(ZlibDecompression) #undef __ENUMERATE_TARGET #define __ENUMERATE_TARGET(x) extern "C" int Test##x(uint8_t const*, size_t); |