Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(699)

Unified Diff: src/wasm/wasm-module.cc

Issue 2661773002: [wasm] Update table bounds when module is instantiated with a table import (Closed)
Patch Set: [wasm] Fix bounds check for imported size > declared initial size of table Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/wasm/indirect-tables.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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),
« no previous file with comments | « no previous file | test/mjsunit/wasm/indirect-tables.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698