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

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

Issue 2049513003: [wasm] Support undefined indirect table entries, behind a flag. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed static casting and formatting. Created 4 years, 6 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 | « src/flag-definitions.h ('k') | src/wasm/wasm-module.h » ('j') | no next file with comments »
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 8ea4802ef40ea8baf81c966314582cae47d6b8d4..5d29df8b202455e4e96fb22891663e1011d89f01 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -270,6 +270,20 @@ class ModuleDecoder : public Decoder {
}
break;
}
+ case WasmSection::Code::FunctionTablePad: {
+ if (!FLAG_wasm_jit_prototype) {
+ error("FunctionTablePad section without jiting enabled");
+ }
+ // An indirect function table requires functions first.
+ int length;
+ module->indirect_table_size =
+ consume_u32v(&length, "indirect entry count");
+ if (module->indirect_table_size > 0 &&
+ module->indirect_table_size < module->function_table.size()) {
+ error("more predefined indirect entries than table can hold");
+ }
+ break;
+ }
case WasmSection::Code::FunctionTable: {
// An indirect function table requires functions first.
CheckForFunctions(module, section);
@@ -289,6 +303,10 @@ class ModuleDecoder : public Decoder {
}
module->function_table.push_back(index);
}
+ if (module->indirect_table_size > 0 &&
+ module->indirect_table_size < module->function_table.size()) {
+ error("more predefined indirect entries than table can hold");
+ }
break;
}
case WasmSection::Code::StartFunction: {
@@ -391,7 +409,7 @@ class ModuleDecoder : public Decoder {
case WasmSection::Code::Max:
// Skip unknown sections.
TRACE("Unknown section: '");
- for (uint32_t i = 0; i != string_length; ++i) {
+ for (uint32_t i = 0; i != string_length; i++) {
TRACE("%c", *(section_name_start + i));
}
TRACE("'\n");
« no previous file with comments | « src/flag-definitions.h ('k') | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698