From f740552daa7c717f3cc0c3c266fa84549b0f203d Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 1 Jun 2016 11:42:45 -0700 Subject: invalid break labels are parse errors --- src/wasm-s-parser.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/wasm-s-parser.h') diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index bb6fe3fd4..e6262c645 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -1107,10 +1107,9 @@ private: if (s.dollared()) { return s.str(); } else { - size_t offset = atol(s.c_str()); - if (offset >= labelStack.size()) - return getPrefixedName("invalid"); // offset, break to nth outside label + uint64_t offset = std::stoll(s.c_str(), nullptr, 0); + if (offset >= labelStack.size()) throw ParseException("total memory must be <= 4GB", s.line, s.col); return labelStack[labelStack.size() - 1 - offset]; } } -- cgit v1.2.3