Index: src/wasm/ast-decoder.cc |
diff --git a/src/wasm/ast-decoder.cc b/src/wasm/ast-decoder.cc |
index bf5eba655689d10965876c4d7a1dceb07b6a7c4e..320b086a8c8865dc4d9d468689bd661e4a89ffc7 100644 |
--- a/src/wasm/ast-decoder.cc |
+++ b/src/wasm/ast-decoder.cc |
@@ -590,7 +590,7 @@ class WasmFullDecoder : public WasmDecoder { |
TRACE("local decls count: %u\n", entries); |
while (entries-- > 0 && pc_ < limit_) { |
uint32_t count = consume_u32v("local count"); |
- if (count > kMaxNumWasmLocals) { |
+ if ((count + local_type_vec_.size()) > kMaxNumWasmLocals) { |
error(pc_ - 1, "local count too large"); |
return; |
} |