From 1c7e82a4c6035d9ab52d892065bfff709a4424f8 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 30 May 2017 14:20:57 -0700 Subject: handle out of range break offset parsing --- src/wasm/wasm-s-parser.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 60d424d7e..5ea8f2b0f 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -1321,6 +1321,8 @@ Name SExpressionWasmBuilder::getLabel(Element& s) { offset = std::stoll(s.c_str(), nullptr, 0); } catch (std::invalid_argument) { throw ParseException("invalid break offset"); + } catch (std::out_of_range) { + throw ParseException("out of range break offset"); } if (offset > nameMapper.labelStack.size()) throw ParseException("invalid label", s.line, s.col); if (offset == nameMapper.labelStack.size()) { -- cgit v1.2.3