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

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

Issue 2648383007: [wasm] Decoding the names section should stop if there is a problem with locals. (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 | « src/wasm/decoder.h ('k') | test/unittests/wasm/module-decoder-unittest.cc » ('j') | 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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 uint32_t function_name_length = 0; 619 uint32_t function_name_length = 0;
620 uint32_t name_offset = 620 uint32_t name_offset =
621 consume_string(inner, &function_name_length, false); 621 consume_string(inner, &function_name_length, false);
622 uint32_t func_index = i; 622 uint32_t func_index = i;
623 if (func_index < module->functions.size()) { 623 if (func_index < module->functions.size()) {
624 module->functions[func_index].name_offset = name_offset; 624 module->functions[func_index].name_offset = name_offset;
625 module->functions[func_index].name_length = function_name_length; 625 module->functions[func_index].name_length = function_name_length;
626 } 626 }
627 627
628 uint32_t local_names_count = inner.consume_u32v("local names count"); 628 uint32_t local_names_count = inner.consume_u32v("local names count");
629 for (uint32_t j = 0; ok() && j < local_names_count; j++) { 629 for (uint32_t j = 0; inner.ok() && j < local_names_count; j++) {
630 uint32_t length = inner.consume_u32v("string length"); 630 uint32_t length = inner.consume_u32v("string length");
631 inner.consume_bytes(length, "string"); 631 inner.consume_bytes(length, "string");
632 } 632 }
633 } 633 }
634 // Skip the whole names section in the outer decoder. 634 // Skip the whole names section in the outer decoder.
635 consume_bytes(section_iter.payload_length(), nullptr); 635 consume_bytes(section_iter.payload_length(), nullptr);
636 section_iter.advance(); 636 section_iter.advance();
637 } 637 }
638 638
639 // ===== Remaining sections ============================================== 639 // ===== Remaining sections ==============================================
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 result.push_back({section_start, name_offset, name_length, payload_offset, 1294 result.push_back({section_start, name_offset, name_length, payload_offset,
1295 payload_length, section_length}); 1295 payload_length, section_length});
1296 } 1296 }
1297 1297
1298 return result; 1298 return result;
1299 } 1299 }
1300 1300
1301 } // namespace wasm 1301 } // namespace wasm
1302 } // namespace internal 1302 } // namespace internal
1303 } // namespace v8 1303 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/decoder.h ('k') | test/unittests/wasm/module-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698