diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-04-10 17:17:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-10 17:17:16 -0700 |
commit | 9b5ce471992033eeec9a8779bce55f2429496431 (patch) | |
tree | 278ba9a543becec6910b65458c162459f4107ebc /src/wasm/wasm-validator.cpp | |
parent | df19ebde22c48fba43f88c71c4870f53b8974f93 (diff) | |
download | binaryen-9b5ce471992033eeec9a8779bce55f2429496431.tar.gz binaryen-9b5ce471992033eeec9a8779bce55f2429496431.tar.bz2 binaryen-9b5ce471992033eeec9a8779bce55f2429496431.zip |
Fix bad param/var type error handling (#1499)
Improve error handling, validation, and assertions for having a non-concrete type in an inappropriate place. Fixes a fuzz testcase.
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index d6c6e7bd0..2e432b174 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -795,6 +795,12 @@ void FunctionValidator::visitHost(Host* curr) { } void FunctionValidator::visitFunction(Function* curr) { + for (auto type : curr->params) { + shouldBeTrue(isConcreteType(type), curr, "params must be concretely typed"); + } + for (auto type : curr->vars) { + shouldBeTrue(isConcreteType(type), curr, "vars must be concretely typed"); + } // if function has no result, it is ignored // if body is unreachable, it might be e.g. a return if (curr->body->type != unreachable) { |