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

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

Issue 2271803004: [wasm] Bound the allowed number of locals. (Closed)
Patch Set: Add a constant for the limit and test it. Created 4 years, 4 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 | « src/wasm/ast-decoder.h ('k') | test/unittests/wasm/ast-decoder-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 80af396021245b2642b4661a250aa332a8a2f74f..798f9d393a5bf10dba8e1c5b5ebb944e1d0f171e 100644
--- a/src/wasm/ast-decoder.cc
+++ b/src/wasm/ast-decoder.cc
@@ -661,8 +661,13 @@ class WasmFullDecoder : public WasmDecoder {
}
// Decode local declarations, if any.
uint32_t entries = consume_u32v("local decls count");
+ TRACE("local decls count: %u\n", entries);
while (entries-- > 0 && pc_ < limit_) {
uint32_t count = consume_u32v("local count");
+ if (count > kMaxNumWasmLocals) {
+ error(pc_ - 1, "local count too large");
+ return;
+ }
byte code = consume_u8("local type");
LocalType type;
switch (code) {
« no previous file with comments | « src/wasm/ast-decoder.h ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698