mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
LibWasm: Jump to the default label in br_table with negative values
Also adds a forgotten Wasm::Printer implementation for printing table branch arguments.
This commit is contained in:
committed by
Ali Mohammad Pur
parent
f5d4e26ff7
commit
d2212a1f51
@@ -617,10 +617,11 @@ void BytecodeInterpreter::interpret(Configuration& configuration, InstructionPoi
|
||||
TRAP_IF_NOT(entry.has<Value>());
|
||||
auto maybe_i = entry.get<Value>().to<i32>();
|
||||
TRAP_IF_NOT(maybe_i.has_value());
|
||||
TRAP_IF_NOT(maybe_i.value() >= 0);
|
||||
size_t i = *maybe_i;
|
||||
if (i < arguments.labels.size())
|
||||
return branch_to_label(configuration, arguments.labels[i]);
|
||||
if (0 <= *maybe_i) {
|
||||
size_t i = *maybe_i;
|
||||
if (i < arguments.labels.size())
|
||||
return branch_to_label(configuration, arguments.labels[i]);
|
||||
}
|
||||
return branch_to_label(configuration, arguments.default_);
|
||||
}
|
||||
case Instructions::call.value(): {
|
||||
|
||||
Reference in New Issue
Block a user