Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/engine/CodeValidator.v3
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ class CodeValidator(extensions: Extension.set, limits: Limits, module: Module, e
ctl_stack.pop();
if (validatingInitExpr && ctl_stack.empty()) { // END finished the init expr
codeptr.reset(codeptr.data, codeptr.pos, codeptr.pos);
} else {
} else if (!ctl_stack.empty()) {
ctl_top = ctl_stack.peek();
}
}
Expand Down
6 changes: 6 additions & 0 deletions test/unittest/CodeValidatorTest.v3
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def X_ = void(
T("simd.binop2", test_simd_binop2),
T("simd.binop3", test_simd_binop3),
T("memarg_stolen_is64", test_memarg_stolen_is64),
T("end_empty_ctl", test_end_empty_ctl),
()
);

Expand Down Expand Up @@ -2418,3 +2419,8 @@ def test_memarg_stolen_is64(t: CodeValidatorTester) {
if ((copy[pos] & BpConstants.MEMARG_STOLEN_IS64) == 0) return t.t.fail1("expected 0x%x flag to be set for memory64", BpConstants.MEMARG_STOLEN_IS64);
}
}

def test_end_empty_ctl(t: CodeValidatorTester) {
t.sig(SigCache.v_v);
t.invalid(WasmError.OOB_LABEL, [u8.!(Opcode.END.code)], 2);
}