summaryrefslogtreecommitdiff
path: root/src/wasm-s-parser.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-06-01 11:42:45 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-06-01 11:42:45 -0700
commitf740552daa7c717f3cc0c3c266fa84549b0f203d (patch)
treec9e4527da03ca1dd7cf18c304e849760c8b932a7 /src/wasm-s-parser.h
parent031c55702bd3770cbf014b7f834e8765dd22a158 (diff)
downloadbinaryen-f740552daa7c717f3cc0c3c266fa84549b0f203d.tar.gz
binaryen-f740552daa7c717f3cc0c3c266fa84549b0f203d.tar.bz2
binaryen-f740552daa7c717f3cc0c3c266fa84549b0f203d.zip
invalid break labels are parse errors
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r--src/wasm-s-parser.h5
1 files changed, 2 insertions, 3 deletions
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];
}
}