summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-06-01 18:45:26 -0700
committerGitHub <noreply@github.com>2017-06-01 18:45:26 -0700
commit6611f548cc1e6b373693cde09e9a7379659e8832 (patch)
treeeb1565a85ee751d1ebc52673916d62d17ef44e36 /src/wasm/wasm-binary.cpp
parent0dc07eaa7db35cf65edbbccebe5c89b995613745 (diff)
parentbd001c187b90a570ce8babaad83af3b420f48eb5 (diff)
downloadbinaryen-6611f548cc1e6b373693cde09e9a7379659e8832.tar.gz
binaryen-6611f548cc1e6b373693cde09e9a7379659e8832.tar.bz2
binaryen-6611f548cc1e6b373693cde09e9a7379659e8832.zip
Merge pull request #1033 from WebAssembly/fuzz2
More misc fuzz fixes
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index c4bc66f76..54b9a5bda 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1684,6 +1684,14 @@ void WasmBinaryBuilder::processFunctions() {
for (auto& func : functions) {
wasm.addFunction(func);
}
+
+ // we should have seen all the functions
+ // we assume this later down in fact, when we read wasm.functions[index],
+ // as index was validated vs functionTypes.size()
+ if (wasm.functions.size() != functionTypes.size()) {
+ throw ParseException("did not see the right number of functions");
+ }
+
// now that we have names for each function, apply things
if (startIndex != static_cast<Index>(-1)) {