mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
Fuzzers: Skip trying to parse invalid UTF-8 in LibJS Fuzzers
Invalid UTF-8 crashes JS::Script::Parse.
This commit is contained in:
committed by
Andreas Kling
parent
f7d2392b6c
commit
cabc99e953
@@ -15,6 +15,9 @@
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
|
||||
{
|
||||
auto js = StringView(static_cast<unsigned char const*>(data), size);
|
||||
// FIXME: https://github.com/SerenityOS/serenity/issues/17899
|
||||
if (!Utf8View(js).validate())
|
||||
return 0;
|
||||
auto vm = MUST(JS::VM::create());
|
||||
auto interpreter = JS::Interpreter::create<JS::GlobalObject>(*vm);
|
||||
auto parse_result = JS::Script::parse(js, interpreter->realm());
|
||||
|
||||
Reference in New Issue
Block a user