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

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

Issue 2290233008: [wasm] Validate the index of set local in AnalyzeLoopAssignment (Closed)
Patch Set: The loop analysis should not do a validation. Created 4 years, 3 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 | test/unittests/wasm/loop-assignment-analysis-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/signature.h" 5 #include "src/signature.h"
6 6
7 #include "src/bit-vector.h" 7 #include "src/bit-vector.h"
8 #include "src/flags.h" 8 #include "src/flags.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/zone-containers.h" 10 #include "src/zone-containers.h"
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 case kExprBlock: 1844 case kExprBlock:
1845 case kExprTryCatch: 1845 case kExprTryCatch:
1846 case kExprTryCatchFinally: 1846 case kExprTryCatchFinally:
1847 case kExprTryFinally: 1847 case kExprTryFinally:
1848 depth++; 1848 depth++;
1849 DCHECK_EQ(1, OpcodeLength(pc)); 1849 DCHECK_EQ(1, OpcodeLength(pc));
1850 break; 1850 break;
1851 case kExprSetLocal: { 1851 case kExprSetLocal: {
1852 LocalIndexOperand operand(this, pc); 1852 LocalIndexOperand operand(this, pc);
1853 if (assigned->length() > 0 && 1853 if (assigned->length() > 0 &&
1854 static_cast<int>(operand.index) < assigned->length()) { 1854 operand.index < static_cast<uint32_t>(assigned->length())) {
1855 // Unverified code might have an out-of-bounds index. 1855 // Unverified code might have an out-of-bounds index.
1856 assigned->Add(operand.index); 1856 assigned->Add(operand.index);
1857 } 1857 }
1858 length = 1 + operand.length; 1858 length = 1 + operand.length;
1859 break; 1859 break;
1860 } 1860 }
1861 case kExprEnd: 1861 case kExprEnd:
1862 depth--; 1862 depth--;
1863 break; 1863 break;
1864 default: 1864 default:
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2064 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 2064 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
2065 const byte* start, const byte* end) { 2065 const byte* start, const byte* end) {
2066 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 2066 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
2067 WasmFullDecoder decoder(zone, nullptr, body); 2067 WasmFullDecoder decoder(zone, nullptr, body);
2068 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 2068 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
2069 } 2069 }
2070 2070
2071 } // namespace wasm 2071 } // namespace wasm
2072 } // namespace internal 2072 } // namespace internal
2073 } // namespace v8 2073 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/wasm/loop-assignment-analysis-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698