/* * Copyright (c) 2020, the SerenityOS developers. * Copyright (c) 2022, Luke Wilde * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include #include extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) { auto js = StringView(static_cast(data), size); // FIXME: https://github.com/SerenityOS/serenity/issues/17899 if (!Utf8View(js).validate()) return 0; auto vm = MUST(JS::VM::create()); auto root_execution_context = JS::create_simple_execution_context(*vm); auto& realm = *root_execution_context->realm; auto parse_result = JS::Script::parse(js, realm); if (!parse_result.is_error()) (void)vm->bytecode_interpreter().run(parse_result.value()); return 0; }