test-fuzz: Add all the missing fuzzers
This commit is contained in:
parent
9690b4011b
commit
0f2b6345c6
Notes:
sideshowbarker
2024-07-17 08:43:11 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/0f2b6345c6 Pull-request: https://github.com/SerenityOS/serenity/pull/18992
4 changed files with 55 additions and 27 deletions
|
@ -62,7 +62,7 @@ set(FUZZER_TARGETS
|
|||
ZlibDecompression
|
||||
)
|
||||
|
||||
if (ENABLE_LAGOM_LIBWEB)
|
||||
if (TARGET LibWeb)
|
||||
list(APPEND FUZZER_TARGETS CSSParser)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue