Index: src/wasm/ast-decoder.cc |
diff --git a/src/wasm/ast-decoder.cc b/src/wasm/ast-decoder.cc |
index 36c6384e080ee50c6185257801cd28e6e9735c13..d596610eb53bc4b89488d60d724449ec49ff99d6 100644 |
--- a/src/wasm/ast-decoder.cc |
+++ b/src/wasm/ast-decoder.cc |
@@ -865,7 +865,7 @@ class WasmFullDecoder : public WasmDecoder { |
SsaEnv* copy = Steal(break_env); |
ssa_env_ = copy; |
- while (iterator.has_next()) { |
+ while (ok() && iterator.has_next()) { |
uint32_t i = iterator.cur_index(); |
const byte* pos = iterator.pc(); |
uint32_t target = iterator.next(); |
@@ -879,6 +879,7 @@ class WasmFullDecoder : public WasmDecoder { |
: BUILD(IfValue, i, sw); |
BreakTo(target); |
} |
+ if (failed()) break; |
} else { |
// Only a default target. Do the equivalent of br. |
const byte* pos = iterator.pc(); |