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

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

Issue 2290233008: [wasm] Validate the index of set local in AnalyzeLoopAssignment (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/unittests/wasm/loop-assignment-analysis-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/ast-decoder.cc
diff --git a/src/wasm/ast-decoder.cc b/src/wasm/ast-decoder.cc
index 798f9d393a5bf10dba8e1c5b5ebb944e1d0f171e..5d541705b21a580933307d9902a73d853d26fc3b 100644
--- a/src/wasm/ast-decoder.cc
+++ b/src/wasm/ast-decoder.cc
@@ -1850,10 +1850,12 @@ class WasmFullDecoder : public WasmDecoder {
break;
case kExprSetLocal: {
LocalIndexOperand operand(this, pc);
- if (assigned->length() > 0 &&
- static_cast<int>(operand.index) < assigned->length()) {
- // Unverified code might have an out-of-bounds index.
- assigned->Add(operand.index);
+ if (Validate(pc_, operand)) {
titzer 2016/09/01 13:12:44 I think if you just remove the static_cast to int,
ahaas 2016/09/01 13:53:15 Done. I think that calling Validate() would have a
+ if (assigned->length() > 0 &&
+ static_cast<int>(operand.index) < assigned->length()) {
+ // Unverified code might have an out-of-bounds index.
+ assigned->Add(operand.index);
+ }
}
length = 1 + operand.length;
break;
« 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