Fuzzers: Add a WebP fuzzer

This commit is contained in:
Nico Weber 2023-02-24 21:09:48 -05:00 committed by Linus Groh
parent 1fc56e56c3
commit a34b300393
Notes: sideshowbarker 2024-07-17 03:05:16 +09:00
2 changed files with 21 additions and 0 deletions

View file

@ -76,6 +76,7 @@ add_simple_fuzzer(FuzzRSAKeyParsing LibCrypto)
add_simple_fuzzer(FuzzVP9Decoder LibVideo)
add_simple_fuzzer(FuzzWAVLoader LibAudio)
add_simple_fuzzer(FuzzWasmParser LibWasm)
add_simple_fuzzer(FuzzWebPLoader LibGfx)
add_simple_fuzzer(FuzzWOFF LibGfx)
add_simple_fuzzer(FuzzXML LibXML)
add_simple_fuzzer(FuzzZip LibArchive)

View file

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGfx/ImageFormats/WebPLoader.h>
#include <stddef.h>
#include <stdint.h>
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{
auto decoder_or_error = Gfx::WebPImageDecoderPlugin::create({ data, size });
if (decoder_or_error.is_error())
return 0;
auto decoder = decoder_or_error.release_value();
decoder->initialize();
(void)decoder->frame(0);
return 0;
}