summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-04-10 17:17:16 -0700
committerGitHub <noreply@github.com>2018-04-10 17:17:16 -0700
commit9b5ce471992033eeec9a8779bce55f2429496431 (patch)
tree278ba9a543becec6910b65458c162459f4107ebc /src/wasm/wasm-validator.cpp
parentdf19ebde22c48fba43f88c71c4870f53b8974f93 (diff)
downloadbinaryen-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.cpp6
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) {