Fuzzers: Add JPEG2000 fuzzer

This commit is contained in:
Nico Weber 2024-03-22 21:31:56 -04:00 committed by Tim Schumacher
parent 9ec5a1591d
commit 2e142105c9
Notes: sideshowbarker 2024-07-17 02:14:39 +09:00
3 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,20 @@
/*
* Copyright (c) 2024, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGfx/ImageFormats/JPEG2000Loader.h>
#include <stddef.h>
#include <stdint.h>
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{
AK::set_debug_enabled(false);
auto decoder_or_error = Gfx::JPEG2000ImageDecoderPlugin::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

@ -20,6 +20,7 @@ set(FUZZER_TARGETS
ILBMLoader
IMAPParser
JBIG2Loader
JPEG2000Loader
JPEGLoader
Js
JsonParser
@ -94,6 +95,7 @@ set(FUZZER_DEPENDENCIES_ICOLoader LibGfx)
set(FUZZER_DEPENDENCIES_ILBMLoader LibGfx)
set(FUZZER_DEPENDENCIES_IMAPParser LibIMAP)
set(FUZZER_DEPENDENCIES_JBIG2Loader LibGfx)
set(FUZZER_DEPENDENCIES_JPEG2000Loader LibGfx)
set(FUZZER_DEPENDENCIES_JPEGLoader LibGfx)
set(FUZZER_DEPENDENCIES_Js LibJS)
set(FUZZER_DEPENDENCIES_LzmaDecompression LibArchive LibCompress)

View file

@ -34,6 +34,7 @@
T(ILBMLoader) \
T(IMAPParser) \
T(JBIG2Loader) \
T(JPEG2000Loader) \
T(JPEGLoader) \
T(Js) \
T(JsonParser) \