Fuzzers: Add a DDS fuzzer

This commit is contained in:
MacDue 2023-07-17 22:36:08 +01:00 committed by Andreas Kling
parent 581236b24a
commit b5658d75f5
Notes: sideshowbarker 2024-07-17 06:39:26 +09:00
3 changed files with 20 additions and 0 deletions

View file

@ -0,0 +1,17 @@
/*
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGfx/ImageFormats/DDSLoader.h>
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{
auto decoder_or_error = Gfx::DDSImageDecoderPlugin::create({ data, size });
if (decoder_or_error.is_error())
return 0;
auto decoder = decoder_or_error.release_value();
(void)decoder->frame(0);
return 0;
}

View file

@ -3,6 +3,7 @@ set(FUZZER_TARGETS
BMPLoader
Brotli
CyrillicDecoder
DDSLoader
DeflateCompression
DeflateDecompression
ELF
@ -72,6 +73,7 @@ set(FUZZER_DEPENDENCIES_BMPLoader LibGfx)
set(FUZZER_DEPENDENCIES_Brotli LibCompress)
set(FUZZER_DEPENDENCIES_CSSParser LibWeb)
set(FUZZER_DEPENDENCIES_CyrillicDecoder LibTextCodec)
set(FUZZER_DEPENDENCIES_DDSLoader LibGfx)
set(FUZZER_DEPENDENCIES_DeflateCompression LibCompress)
set(FUZZER_DEPENDENCIES_DeflateDecompression LibCompress)
set(FUZZER_DEPENDENCIES_ELF LibELF)

View file

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