mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWasm: Make sure try_table creates a new frame while validating
The spec says that while validating this opcode a new label should be pushed. Fixes a crash in instance.wast on WPT.
This commit is contained in:
parent
07c86542b6
commit
7bccd65b4a
Notes:
github-actions[bot]
2025-10-19 15:29:18 +00:00
Author: https://github.com/cqundefine
Commit: 7bccd65b4a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6511
Reviewed-by: https://github.com/alimpfard ✅
2 changed files with 11 additions and 0 deletions
|
|
@ -2091,6 +2091,16 @@ VALIDATE_INSTRUCTION(try_table)
|
|||
{
|
||||
auto& args = instruction.arguments().get<Instruction::TryTableArgs>();
|
||||
auto block_type = TRY(validate(args.try_.block_type));
|
||||
|
||||
auto& parameters = block_type.parameters();
|
||||
for (size_t i = 1; i <= parameters.size(); ++i)
|
||||
TRY(stack.take(parameters[parameters.size() - i]));
|
||||
|
||||
m_frames.empend(block_type, FrameKind::TryTable, stack.size());
|
||||
m_max_frame_size = max(m_max_frame_size, m_frames.size());
|
||||
for (auto& parameter : parameters)
|
||||
stack.append(parameter);
|
||||
|
||||
for (auto& catch_ : args.catches) {
|
||||
auto label = catch_.target_label();
|
||||
TRY(validate(label));
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ public:
|
|||
If,
|
||||
Else,
|
||||
Function,
|
||||
TryTable,
|
||||
};
|
||||
|
||||
struct Frame {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue