Skip to content

Commit c278cf7

Browse files
committed
Use type equality when checking type of imported tables
1 parent d5ca223 commit c278cf7

File tree

1 file changed

+3
-1
lines changed
  • wasm/src/org.graalvm.wasm/src/org/graalvm/wasm

1 file changed

+3
-1
lines changed

wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/Linker.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,9 @@ void resolveTableImport(WasmStore store, WasmInstance instance, ImportDescriptor
873873
// MAX_TABLE_DECLARATION_SIZE, so this condition will pass.
874874
assertUnsignedIntLessOrEqual(declaredMinSize, importedTable.minSize(), Failure.INCOMPATIBLE_IMPORT_TYPE);
875875
assertUnsignedIntGreaterOrEqual(declaredMaxSize, importedTable.declaredMaxSize(), Failure.INCOMPATIBLE_IMPORT_TYPE);
876-
assertTrue(instance.symbolTable().closedTypeOf(elemType).isSupertypeOf(importedTable.closedElemType()), Failure.INCOMPATIBLE_IMPORT_TYPE);
876+
// when matching element types of imported tables, we need to check for type equivalence
877+
// instead of subtyping, as tables have read/write access
878+
assertTrue(instance.symbolTable().closedTypeOf(elemType).equals(importedTable.closedElemType()), Failure.INCOMPATIBLE_IMPORT_TYPE);
877879
instance.setTableAddress(tableIndex, tableAddress);
878880
};
879881
final ImportTableSym importTableSym = new ImportTableSym(instance.name(), importDescriptor);

0 commit comments

Comments
 (0)