summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-12-13 13:17:52 -0800
committerGitHub <noreply@github.com>2018-12-13 13:17:52 -0800
commit802dd8ff76d423f438c1d69dd5da6c47bb762c88 (patch)
treed769c51bcb569125bbde71a09d2e8e9d1fad02ac
parente4ad86cafeb6d636ccf96e2deefedbc388612a6e (diff)
downloadbinaryen-802dd8ff76d423f438c1d69dd5da6c47bb762c88.tar.gz
binaryen-802dd8ff76d423f438c1d69dd5da6c47bb762c88.tar.bz2
binaryen-802dd8ff76d423f438c1d69dd5da6c47bb762c88.zip
Don't error on too many locals - just oom (#1822)
I think I added this error for fuzzing, but it is harmful as it prevents a module with too many locals from being loaded - if we could load it, we might be able to optimize it to have fewer locals...
-rw-r--r--src/wasm/wasm-binary.cpp8
-rw-r--r--test/crash/h01.wasmbin721 -> 0 bytes
2 files changed, 0 insertions, 8 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index c1cb02375..2a7bff51f 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1081,14 +1081,6 @@ void WasmBinaryBuilder::readFunctions() {
for (size_t t = 0; t < numLocalTypes; t++) {
auto num = getU32LEB();
auto type = getConcreteType();
- if (num > WebLimitations::MaxFunctionLocals) {
- // In general for Web limitations we try to just warn, but not actually
- // enforce the limit ourselves (as we may be looking at wasm not intended
- // to run on the Web). However, too many locals will simply cause us to
- // OOM, so some arbitrary limit makes sense - and if so, why not use
- // the arbitrary Web limit, for consistency.
- throwError("too many locals, wasm VMs would not accept this binary");
- }
while (num > 0) {
func->vars.push_back(type);
num--;
diff --git a/test/crash/h01.wasm b/test/crash/h01.wasm
deleted file mode 100644
index 8fd02a1f2..000000000
--- a/test/crash/h01.wasm
+++ /dev/null
Binary files differ