summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-s-parser.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2019-02-06 12:57:29 -0800
committerGitHub <noreply@github.com>2019-02-06 12:57:29 -0800
commit327245dfe20d45cf6782d8e4ca53fe1f86abd6a9 (patch)
tree26a94a949e6b492ca16c93f0bc003751d7556c88 /src/wasm/wasm-s-parser.cpp
parentf424f81886405fc26a415fc86900c0f8d0df14eb (diff)
downloadbinaryen-327245dfe20d45cf6782d8e4ca53fe1f86abd6a9.tar.gz
binaryen-327245dfe20d45cf6782d8e4ca53fe1f86abd6a9.tar.bz2
binaryen-327245dfe20d45cf6782d8e4ca53fe1f86abd6a9.zip
throw an early error in s-expr-parsing makeBlock, if not inside a function (#1894)
Fixes #1893
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r--src/wasm/wasm-s-parser.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 09cc044bf..d7b3824a9 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -786,6 +786,7 @@ Expression* SExpressionWasmBuilder::makeSetGlobal(Element& s) {
Expression* SExpressionWasmBuilder::makeBlock(Element& s) {
+ if (!currFunction) throw ParseException("block is unallowed outside of functions");
// special-case Block, because Block nesting (in their first element) can be incredibly deep
auto curr = allocator.alloc<Block>();
auto* sp = &s;