diff options
author | Alon Zakai <alonzakai@gmail.com> | 2019-02-06 12:57:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-06 12:57:29 -0800 |
commit | 327245dfe20d45cf6782d8e4ca53fe1f86abd6a9 (patch) | |
tree | 26a94a949e6b492ca16c93f0bc003751d7556c88 /src/wasm/wasm-s-parser.cpp | |
parent | f424f81886405fc26a415fc86900c0f8d0df14eb (diff) | |
download | binaryen-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.cpp | 1 |
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; |