Lagom/Fuzzers: Add a fuzzer for our TIFF decoder

This commit is contained in:
Lucas CHOLLET 2023-10-29 00:54:57 -04:00 committed by Andrew Kaster
parent 26a3be17c8
commit 8612aee640
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 <LibGfx/ImageFormats/TIFFLoader.h>
#include <stdio.h>
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{
auto decoder_or_error = Gfx::TIFFImageDecoderPlugin::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

@ -53,6 +53,7 @@ set(FUZZER_TARGETS
SQLParser
Tar
TGALoader
TIFFLoader
TTF
TinyVGLoader
URL
@ -126,6 +127,7 @@ set(FUZZER_DEPENDENCIES_ShellPosix LibShell)
set(FUZZER_DEPENDENCIES_SQLParser LibSQL)
set(FUZZER_DEPENDENCIES_Tar LibArchive)
set(FUZZER_DEPENDENCIES_TGALoader LibGfx)
set(FUZZER_DEPENDENCIES_TIFFLoader LibGfx)
set(FUZZER_DEPENDENCIES_TTF LibGfx)
set(FUZZER_DEPENDENCIES_TinyVGLoader LibGfx)
set(FUZZER_DEPENDENCIES_UTF16BEDecoder LibTextCodec)

View file

@ -67,6 +67,7 @@
T(SQLParser) \
T(Tar) \
T(TGALoader) \
T(TIFFLoader) \
T(TTF) \
T(TinyVGLoader) \
T(URL) \