mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:07:36 +00:00
Meta: Move global VM creation to fuzzer "global" structure
Turns out LLVMFuzzerTestOneInput may be called more than once per process.
This commit is contained in:
parent
87bfb47d1f
commit
1b260ab1f8
1 changed files with 8 additions and 3 deletions
|
@ -9,16 +9,21 @@
|
||||||
#include <LibWeb/Platform/EventLoopPluginSerenity.h>
|
#include <LibWeb/Platform/EventLoopPluginSerenity.h>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct Globals {
|
struct Globals {
|
||||||
Globals();
|
Globals();
|
||||||
} globals;
|
} globals;
|
||||||
Globals::Globals() { Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity); }
|
|
||||||
|
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)
|
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
|
||||||
{
|
{
|
||||||
MUST(Web::Bindings::initialize_main_thread_vm());
|
|
||||||
|
|
||||||
// FIXME: There's got to be a better way to do this "correctly"
|
// FIXME: There's got to be a better way to do this "correctly"
|
||||||
auto& vm = Web::Bindings::main_thread_vm();
|
auto& vm = Web::Bindings::main_thread_vm();
|
||||||
(void)Web::parse_css_stylesheet(Web::CSS::Parser::ParsingContext(*vm.current_realm()), { data, size });
|
(void)Web::parse_css_stylesheet(Web::CSS::Parser::ParsingContext(*vm.current_realm()), { data, size });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue