Skip to content

Commit 6f410f3

Browse files
committed
fix: builtin_call_indirect does not manage GC obj correctly
In AS calling conversion, arguments should be managed by callee in shadowstack. builtin_call_indirect does not follow this call conversion.
1 parent f16b08f commit 6f410f3

File tree

5 files changed

+4527
-0
lines changed

5 files changed

+4527
-0
lines changed

src/builtins.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3653,6 +3653,9 @@ function builtin_call_indirect(ctx: BuiltinFunctionContext): ExpressionRef {
36533653
let paramTypeRefs = new Array<TypeRef>(numOperands);
36543654
for (let i = 0; i < numOperands; ++i) {
36553655
operandExprs[i] = compiler.compileExpression(operands[1 + i], Type.auto);
3656+
if (compiler.currentType.isManaged) {
3657+
operandExprs[i] = module.tostack(operandExprs[i]);
3658+
}
36563659
paramTypeRefs[i] = compiler.currentType.toRef();
36573660
}
36583661
compiler.currentType = returnType;

0 commit comments

Comments
 (0)