mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 02:55:49 +03:00
1b260ab1f8
Turns out LLVMFuzzerTestOneInput may be called more than once per process.
32 lines
785 B
C++
32 lines
785 B
C++
/*
|
|
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/MainThreadVM.h>
|
|
#include <LibWeb/CSS/Parser/Parser.h>
|
|
#include <LibWeb/Platform/EventLoopPluginSerenity.h>
|
|
|
|
namespace {
|
|
|
|
struct Globals {
|
|
Globals();
|
|
} globals;
|
|
|
|
Globals::Globals()
|
|
{
|
|
Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity);
|
|
MUST(Web::Bindings::initialize_main_thread_vm());
|
|
}
|
|
|
|
}
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
|
|
{
|
|
// FIXME: There's got to be a better way to do this "correctly"
|
|
auto& vm = Web::Bindings::main_thread_vm();
|
|
(void)Web::parse_css_stylesheet(Web::CSS::Parser::ParsingContext(*vm.current_realm()), { data, size });
|
|
return 0;
|
|
}
|