summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAshley Nelson <nashley@google.com>2022-10-07 17:14:50 -0700
committerGitHub <noreply@github.com>2022-10-07 17:14:50 -0700
commit2f722471e55b3bc7c013763d6dc9043fba7317d8 (patch)
tree872e5bdd62354348f17beb0b85576032f1ab94f2 /src
parentada164df40f9b590f546dfecdddecc3894e345ae (diff)
downloadbinaryen-2f722471e55b3bc7c013763d6dc9043fba7317d8.tar.gz
binaryen-2f722471e55b3bc7c013763d6dc9043fba7317d8.tar.bz2
binaryen-2f722471e55b3bc7c013763d6dc9043fba7317d8.zip
Validate memory initial < max only if memory hasMax (#5125)
Making a change to wasm-validator so that Memory::kUnlimitedSize is treated properly like an unlimited case. The check for whether memory.initial < memory.max will only happen if memory.hasMax() — meaning if memory.max is not set to kUnlimitedSize.
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-validator.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index ba309ddea..91236fe54 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -3145,8 +3145,10 @@ static void validateMemories(Module& module, ValidationInfo& info) {
"multiple memories present, but multi-memories is disabled");
}
for (auto& memory : module.memories) {
- info.shouldBeFalse(
- memory->initial > memory->max, "memory", "memory max >= initial");
+ if (memory->hasMax()) {
+ info.shouldBeFalse(
+ memory->initial > memory->max, "memory", "memory max >= initial");
+ }
if (memory->is64()) {
info.shouldBeTrue(module.features.hasMemory64(),
"memory",