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

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

Issue 2501873003: [wasm] Be more lenient on the names section. (Closed)
Patch Set: Fix builders to add empty import names. Created 4 years, 1 month 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-builder.cc » ('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 5d5bcf2a5bccae4028e07aec2a1ef1fa4626fc78..c8eace3c10ece1edb8bc160e4fe02fa2874f2cf6 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -623,17 +623,16 @@ class ModuleDecoder : public Decoder {
// ===== Name section ====================================================
if (section_iter.section_code() == kNameSectionCode) {
- const byte* pos = pc_;
uint32_t functions_count = consume_u32v("functions count");
- if (functions_count != module->num_declared_functions) {
- error(pos, pos, "function name count %u mismatch (%u expected)",
- functions_count, module->num_declared_functions);
- }
for (uint32_t i = 0; ok() && i < functions_count; ++i) {
- WasmFunction* function =
- &module->functions[i + module->num_imported_functions];
- function->name_offset = consume_string(&function->name_length, false);
+ uint32_t function_name_length = 0;
+ uint32_t name_offset = consume_string(&function_name_length, false);
+ uint32_t func_index = i;
+ if (func_index < module->functions.size()) {
+ module->functions[func_index].name_offset = name_offset;
+ module->functions[func_index].name_length = function_name_length;
+ }
uint32_t local_names_count = consume_u32v("local names count");
for (uint32_t j = 0; ok() && j < local_names_count; j++) {
« no previous file with comments | « no previous file | src/wasm/wasm-module-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698