Index: src/wasm/wasm-module.cc |
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc |
index e4188da72a3bf1b0545c5a712c18c218ff5da8ba..8a40ee3ea53e3dc80b38d90804b026745ce7ee9b 100644 |
--- a/src/wasm/wasm-module.cc |
+++ b/src/wasm/wasm-module.cc |
@@ -2101,6 +2101,13 @@ class WasmInstanceBuilder { |
table_instance.signature_table->set(i, |
Smi::FromInt(kInvalidSigIndex)); |
} |
+ } else { |
+ // Table is imported, patch table bounds check |
+ DCHECK(table_size <= table_instance.function_table->length()); |
+ if (table_size < table_instance.function_table->length()) { |
+ RelocateTableSizeReferences(code_table, table_size, |
+ table_instance.function_table->length()); |
+ } |
} |
new_function_tables->set(static_cast<int>(index), |