summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2021-03-19 15:39:01 -0700
committerGitHub <noreply@github.com>2021-03-19 15:39:01 -0700
commit6856f261d78ba245b0f6364ad4683778e022b5d2 (patch)
tree4c97f1a97822798014e8659fde7cb84c6e08991a /src/wasm/wasm-binary.cpp
parent5d9a6049c08c3b9e7ddb0c061f15b2731c6bad77 (diff)
downloadbinaryen-6856f261d78ba245b0f6364ad4683778e022b5d2.tar.gz
binaryen-6856f261d78ba245b0f6364ad4683778e022b5d2.tar.bz2
binaryen-6856f261d78ba245b0f6364ad4683778e022b5d2.zip
Fixed reading 64-bit memories and output of globals (#3709)
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index c8568e469..37fa1ab78 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1926,17 +1926,17 @@ void WasmBinaryBuilder::getResizableLimits(Address& initial,
Type& indexType,
Address defaultIfNoMax) {
auto flags = getU32LEB();
- initial = getU32LEB();
bool hasMax = (flags & BinaryConsts::HasMaximum) != 0;
bool isShared = (flags & BinaryConsts::IsShared) != 0;
bool is64 = (flags & BinaryConsts::Is64) != 0;
+ initial = is64 ? getU64LEB() : getU32LEB();
if (isShared && !hasMax) {
throwError("shared memory must have max size");
}
shared = isShared;
indexType = is64 ? Type::i64 : Type::i32;
if (hasMax) {
- max = getU32LEB();
+ max = is64 ? getU64LEB() : getU32LEB();
} else {
max = defaultIfNoMax;
}