From 00dd3b97455652113fa36cf639315388052f502d Mon Sep 17 00:00:00 2001 From: "Alon Zakai (kripken)" Date: Thu, 13 Jul 2017 12:00:11 -0700 Subject: fix validation of memBytes, if the load type is unreachable, we can't and shouldn't try to validate --- src/wasm/wasm-validator.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/wasm/wasm-validator.cpp') diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index c1f44a68b..25f2588d3 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -237,14 +237,17 @@ void WasmValidator::visitAtomicRMW(AtomicRMW* curr) { void WasmValidator::visitAtomicCmpxchg(AtomicCmpxchg* curr) { validateMemBytes(curr->bytes, curr->type, curr); } -void WasmValidator::validateMemBytes(uint8_t bytes, WasmType ty, Expression* curr) { +void WasmValidator::validateMemBytes(uint8_t bytes, WasmType type, Expression* curr) { + if (type == unreachable) { + return; // nothing to validate in this case + } switch (bytes) { case 1: case 2: case 4: break; case 8: { - shouldBeEqual(getWasmTypeSize(ty), 8U, curr, "8-byte mem operations are only allowed with 8-byte wasm types"); + shouldBeEqual(getWasmTypeSize(type), 8U, curr, "8-byte mem operations are only allowed with 8-byte wasm types"); break; } default: fail("Memory operations must be 1,2,4, or 8 bytes", curr); -- cgit v1.2.3