summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
authorAlon Zakai (kripken) <alonzakai@gmail.com>2017-05-27 10:38:18 -0700
committerAlon Zakai <alonzakai@gmail.com>2017-06-01 13:16:53 -0700
commit4f33690ae906622adcf06f2c4b1f3436da4c3448 (patch)
tree162f6c65839aa434bfbfe24c062a0556c7e4bd82 /src/wasm/wasm-binary.cpp
parentadbb5e5c4469d720c4804d5825719cf57b9f18c8 (diff)
downloadbinaryen-4f33690ae906622adcf06f2c4b1f3436da4c3448.tar.gz
binaryen-4f33690ae906622adcf06f2c4b1f3436da4c3448.tar.bz2
binaryen-4f33690ae906622adcf06f2c4b1f3436da4c3448.zip
handle the wrong number of functions being provided in binary format
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)) {