summaryrefslogtreecommitdiff
path: root/src/wasm-s-parser.h
diff options
context:
space:
mode:
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];
}
}