mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
AK+LibWasm+LibJS: Disallow Variant.has() on types that aren't contained
Checking for this (and get()'ing it) is always invalid, so let's just disallow it. This also finds two bugs where the code is checking for types that can never actually be in the variant (which was actually a refactor artifact).
This commit is contained in:
parent
87ff76bd57
commit
ea7ba34a31
Notes:
sideshowbarker
2024-07-18 17:00:48 +09:00
Author: https://github.com/alimpfard
Commit: ea7ba34a31
Pull-request: https://github.com/SerenityOS/serenity/pull/7696
3 changed files with 16 additions and 16 deletions
|
@ -482,12 +482,12 @@ void BytecodeInterpreter::interpret(Configuration& configuration, InstructionPoi
|
|||
return;
|
||||
}
|
||||
auto element = table_instance->elements()[index.value()];
|
||||
if (!element.has_value() || !element->ref().has<FunctionAddress>()) {
|
||||
if (!element.has_value() || !element->ref().has<Reference::Func>()) {
|
||||
dbgln("LibWasm: call_indirect attempted with invalid address element (not a function)");
|
||||
m_do_trap = true;
|
||||
return;
|
||||
}
|
||||
auto address = element->ref().get<FunctionAddress>();
|
||||
auto address = element->ref().get<Reference::Func>().address;
|
||||
dbgln_if(WASM_TRACE_DEBUG, "call_indirect({} -> {})", index.value(), address.value());
|
||||
call_address(configuration, address);
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue