Fuzzers: Add a DNS packet fuzzer

This commit is contained in:
Tim Ledbetter 2023-11-02 20:12:48 +00:00 committed by Andreas Kling
parent 2fbaeb9694
commit 33ad384a7d
Notes: sideshowbarker 2024-07-17 22:09:47 +09:00
3 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,18 @@
/*
* Copyright (c) 2023, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibDNS/Packet.h>
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{
AK::set_debug_enabled(false);
auto maybe_packet = DNS::Packet::from_raw_packet({ data, size });
if (!maybe_packet.has_value())
return 0;
(void)maybe_packet.value().to_byte_buffer();
return 0;
}

View file

@ -5,6 +5,7 @@ set(FUZZER_TARGETS
Brotli
CyrillicDecoder
DDSLoader
DNSPacket
DeflateCompression
DeflateDecompression
ELF
@ -80,6 +81,7 @@ set(FUZZER_DEPENDENCIES_Brotli LibCompress)
set(FUZZER_DEPENDENCIES_CSSParser LibWeb)
set(FUZZER_DEPENDENCIES_CyrillicDecoder LibTextCodec)
set(FUZZER_DEPENDENCIES_DDSLoader LibGfx)
set(FUZZER_DEPENDENCIES_DNSPacket LibDNS)
set(FUZZER_DEPENDENCIES_DeflateCompression LibCompress)
set(FUZZER_DEPENDENCIES_DeflateDecompression LibCompress)
set(FUZZER_DEPENDENCIES_ELF LibELF)

View file

@ -19,6 +19,7 @@
T(CSSParser) \
T(CyrillicDecoder) \
T(DDSLoader) \
T(DNSPacket) \
T(DeflateCompression) \
T(DeflateDecompression) \
T(ELF) \