diff options
author | Alon Zakai <azakai@google.com> | 2020-10-08 20:07:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-08 20:07:00 -0700 |
commit | 87fddcb0aa28f322c0781c08cca6ce2a756d8728 (patch) | |
tree | 0e7f5e4bfea7908a7ddc16682c69ff854a1b0d41 /src | |
parent | c8661e115309626a87708cb25067b6a3210367fe (diff) | |
download | binaryen-87fddcb0aa28f322c0781c08cca6ce2a756d8728.tar.gz binaryen-87fddcb0aa28f322c0781c08cca6ce2a756d8728.tar.bz2 binaryen-87fddcb0aa28f322c0781c08cca6ce2a756d8728.zip |
Validate memory64 (#3202)
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-features.h | 1 | ||||
-rw-r--r-- | src/wasm/wasm-validator.cpp | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/wasm-features.h b/src/wasm-features.h index 6e74e0b29..a2bb52971 100644 --- a/src/wasm-features.h +++ b/src/wasm-features.h @@ -91,6 +91,7 @@ struct FeatureSet { bool hasReferenceTypes() const { return (features & ReferenceTypes) != 0; } bool hasMultivalue() const { return (features & Multivalue) != 0; } bool hasGC() const { return (features & GC) != 0; } + bool hasMemory64() const { return (features & Memory64) != 0; } bool hasAll() const { return (features & All) != 0; } void makeMVP() { features = MVP; } 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"); |