From 87fddcb0aa28f322c0781c08cca6ce2a756d8728 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 8 Oct 2020 20:07:00 -0700 Subject: Validate memory64 (#3202) --- src/wasm/wasm-validator.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/wasm/wasm-validator.cpp') diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 96871ad8e..644358c04 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2519,7 +2519,11 @@ static void validateMemory(Module& module, ValidationInfo& info) { auto& curr = module.memory; info.shouldBeFalse( curr.initial > curr.max, "memory", "memory max >= initial"); - if (!curr.is64()) { + if (curr.is64()) { + info.shouldBeTrue(module.features.hasMemory64(), + "memory", + "memory is 64-bit, but memory64 is disabled"); + } else { info.shouldBeTrue(curr.initial <= Memory::kMaxSize32, "memory", "initial memory must be <= 4GB"); -- cgit v1.2.3