mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 18:05:07 +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
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