diff options
author | Alon Zakai <alonzakai@gmail.com> | 2019-02-07 14:20:45 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-07 14:20:45 -0800 |
commit | 66dc2673a46e7041809cd990f016df843e6f27d0 (patch) | |
tree | f7f9b8c364ef7687e77c98f226de56d4794cf026 /src | |
parent | ab35a43ed3f3e5173b511e7e00239c50172fbddf (diff) | |
download | binaryen-66dc2673a46e7041809cd990f016df843e6f27d0.tar.gz binaryen-66dc2673a46e7041809cd990f016df843e6f27d0.tar.bz2 binaryen-66dc2673a46e7041809cd990f016df843e6f27d0.zip |
Fix a fuzz bug with peeking forward in binary reading. (#1902)
Fixes #1900
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 721884126..7aeb80715 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1806,8 +1806,7 @@ void WasmBinaryBuilder::visitBlock(Block* curr) { curr->name = getNextLabel(); breakStack.push_back({curr->name, curr->type != none}); stack.push_back(curr); - auto peek = input[pos]; - if (peek == BinaryConsts::Block) { + if (more() && input[pos] == BinaryConsts::Block) { // a recursion readNextDebugLocation(); curr = allocator.alloc<Block>(); |