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

Side by Side Diff: src/wasm/module-decoder.cc

Issue 2661553002: Revert of Merged: [wasm] Fix check failure on invalid name section (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/wasm/module-decoder.h" 5 #include "src/wasm/module-decoder.h"
6 6
7 #include "src/base/functional.h" 7 #include "src/base/functional.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/flags.h" 9 #include "src/flags.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 } 608 }
609 609
610 // ===== Name section ==================================================== 610 // ===== Name section ====================================================
611 if (section_iter.section_code() == kNameSectionCode) { 611 if (section_iter.section_code() == kNameSectionCode) {
612 uint32_t functions_count = consume_u32v("functions count"); 612 uint32_t functions_count = consume_u32v("functions count");
613 613
614 for (uint32_t i = 0; ok() && i < functions_count; ++i) { 614 for (uint32_t i = 0; ok() && i < functions_count; ++i) {
615 uint32_t function_name_length = 0; 615 uint32_t function_name_length = 0;
616 uint32_t name_offset = consume_string(&function_name_length, false); 616 uint32_t name_offset = consume_string(&function_name_length, false);
617 uint32_t func_index = i; 617 uint32_t func_index = i;
618 if (inner.ok() && func_index < module->functions.size()) { 618 if (func_index < module->functions.size()) {
619 module->functions[func_index].name_offset = name_offset; 619 module->functions[func_index].name_offset = name_offset;
620 module->functions[func_index].name_length = function_name_length; 620 module->functions[func_index].name_length = function_name_length;
621 } 621 }
622 622
623 uint32_t local_names_count = consume_u32v("local names count"); 623 uint32_t local_names_count = consume_u32v("local names count");
624 for (uint32_t j = 0; ok() && j < local_names_count; j++) { 624 for (uint32_t j = 0; ok() && j < local_names_count; j++) {
625 skip_string(); 625 skip_string();
626 } 626 }
627 } 627 }
628 section_iter.advance(); 628 section_iter.advance();
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 table.push_back(std::move(func_asm_offsets)); 1245 table.push_back(std::move(func_asm_offsets));
1246 } 1246 }
1247 if (decoder.more()) decoder.error("unexpected additional bytes"); 1247 if (decoder.more()) decoder.error("unexpected additional bytes");
1248 1248
1249 return decoder.toResult(std::move(table)); 1249 return decoder.toResult(std::move(table));
1250 } 1250 }
1251 1251
1252 } // namespace wasm 1252 } // namespace wasm
1253 } // namespace internal 1253 } // namespace internal
1254 } // namespace v8 1254 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698