From af6b1a77673b1c49f4501918385bd463c50cb28b Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 29 Apr 2016 14:59:10 -0700 Subject: validate in binaryen shell and on wasm binaries, and fix type checking --- src/wasm-binary.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/wasm-binary.h') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 0bd86ffb6..89073b8be 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -31,6 +31,7 @@ #include "asm_v_wasm.h" #include "wasm-builder.h" #include "ast_utils.h" +#include "wasm-validator.h" namespace wasm { @@ -1187,6 +1188,10 @@ public: } processFunctions(); + + if (!WasmValidator().validate(wasm)) { + abort(); + } } bool more() { @@ -1727,6 +1732,7 @@ public: curr->name = getBreakName(getU32LEB()); if (code == BinaryConsts::BrIf) curr->condition = popExpression(); if (arity == 1) curr->value = popExpression(); + curr->finalize(); } void visitSwitch(Switch *curr) { if (debug) std::cerr << "zz node: Switch" << std::endl; -- cgit v1.2.3