mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 13:02:28 +00:00
LibWasm: Validate potentially empty else
branch in if
instruction
This commit is contained in:
parent
24adb1c452
commit
fce8ed1563
Notes:
sideshowbarker
2024-07-17 20:22:04 +09:00
Author: https://github.com/dzfrias
Commit: fce8ed1563
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/418
1 changed files with 7 additions and 0 deletions
|
@ -1939,6 +1939,13 @@ VALIDATE_INSTRUCTION(structured_end)
|
||||||
|
|
||||||
auto& last_frame = m_frames.last();
|
auto& last_frame = m_frames.last();
|
||||||
|
|
||||||
|
// If this is true, then the `if` had no else. In that case, validate that the
|
||||||
|
// empty else block produces the correct type.
|
||||||
|
if (last_frame.kind == FrameKind::If) {
|
||||||
|
bool is_constant = false;
|
||||||
|
TRY(validate(Instruction(Instructions::structured_else), stack, is_constant));
|
||||||
|
}
|
||||||
|
|
||||||
auto& results = last_frame.type.results();
|
auto& results = last_frame.type.results();
|
||||||
for (size_t i = 1; i <= results.size(); ++i)
|
for (size_t i = 1; i <= results.size(); ++i)
|
||||||
TRY(stack.take(results[results.size() - i]));
|
TRY(stack.take(results[results.size() - i]));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue