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

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

Issue 2433313002: [wasm] Only use the table maximum in allocation if it is non-zero. (Closed)
Patch Set: Created 4 years, 2 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 | src/wasm/wasm-module.cc » ('j') | src/wasm/wasm-module.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/module-decoder.cc
diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc
index 4f0304722d1554ff2c118535d95e37e70e042068..6aee4467fdc534762ef6dc48e410c9b054574447 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -31,6 +31,8 @@ namespace {
const char* kNameString = "name";
const size_t kNameStringLength = 4;
+static const uint32_t kMaxTableSize = 1 << 28;
+
LocalType TypeOf(const WasmModule* module, const WasmInitExpr& expr) {
switch (expr.kind) {
case WasmInitExpr::kNone:
@@ -313,7 +315,7 @@ class ModuleDecoder : public Decoder {
{0, 0, std::vector<int32_t>(), true, false, SignatureMap()});
expect_u8("element type", 0x20);
WasmIndirectFunctionTable* table = &module->function_tables.back();
- consume_resizable_limits("element count", "elements", kMaxUInt32,
+ consume_resizable_limits("element count", "elements", kMaxTableSize,
&table->size, &table->max_size);
break;
}
« no previous file with comments | « no previous file | src/wasm/wasm-module.cc » ('j') | src/wasm/wasm-module.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698