From 3f3fc857ff6204517281ed5caa3209cc8f02d4fc Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 27 Dec 2018 15:24:57 -0800 Subject: Fix fuzzing JS glue code (#1843) After we added logging to the fuzzer, we forgot to add to the JS glue code the necessary imports so it can be run there too. Also adds legalization for the JS glue code imports and exports. Also adds a missing validator check on imports having a function type (the fuzzing code was missing one). Fixes #1842 --- src/wasm/wasm-validator.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/wasm/wasm-validator.cpp') diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index ef4d90fbd..d11d02353 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -1069,6 +1069,9 @@ void FunctionValidator::visitFunction(Function* curr) { shouldBeTrue(ft->params == curr->params, curr->name, "function params must match its declared type"); shouldBeTrue(ft->result == curr->result, curr->name, "function result must match its declared type"); } + if (curr->imported()) { + shouldBeTrue(curr->type.is(), curr->name, "imported functions must have a function type"); + } } static bool checkOffset(Expression* curr, Address add, Address max) { -- cgit v1.2.3