ladybird/Meta/Lagom/Fuzzers/FuzzJPEGLoader.cpp

21 lines
529 B
C++
Raw Normal View History

2020-11-19 11:41:43 -05:00
/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
2020-11-19 11:41:43 -05:00
*/
#include <LibGfx/ImageFormats/JPEGLoader.h>
2020-11-19 11:41:43 -05:00
#include <stddef.h>
#include <stdint.h>
2022-04-01 20:58:27 +03:00
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
2020-11-19 11:41:43 -05:00
{
AK::set_debug_enabled(false);
auto decoder_or_error = Gfx::JPEGImageDecoderPlugin::create({ data, size });
if (decoder_or_error.is_error())
return 0;
auto decoder = decoder_or_error.release_value();
(void)decoder->frame(0);
2020-11-19 11:41:43 -05:00
return 0;
}