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"); |