summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-s-parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r--src/wasm/wasm-s-parser.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index f9e3912f7..9b053d5b8 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -185,9 +185,11 @@ Element* SExpressionParser::parseString() {
input++;
std::string str;
while (1) {
+ if (input[0] == 0) throw ParseException("unterminated string", line, start - lineStart);
if (input[0] == '"') break;
if (input[0] == '\\') {
str += input[0];
+ if (input[1] == 0) throw ParseException("unterminated string escape", line, start - lineStart);
str += input[1];
input += 2;
continue;