Skip to content

Commit 0894370

Browse files
committed
fix: avoid to visit nullptr in binaryen
Module.getExpressionId will be used for nullptr ExpressionRef. It works because deref nullptr in binaryen's wasm is valid. Adding guard can enhance robustness
1 parent 6cd638e commit 0894370

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/module.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3019,6 +3019,7 @@ export function isNullableType(type: TypeRef): bool {
30193019
// expressions
30203020

30213021
export function getExpressionId(expr: ExpressionRef): ExpressionId {
3022+
if (expr == 0) return ExpressionId.Invalid;
30223023
return binaryen._BinaryenExpressionGetId(expr);
30233024
}
30243025

0 commit comments

Comments
 (0)