summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index f3642203d..b8c3f1049 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1540,7 +1540,10 @@ void WasmBinaryBuilder::readDataSegments() {
}
curr.isPassive = flags & BinaryConsts::IsPassive;
if (flags & BinaryConsts::HasMemIndex) {
- curr.index = getU32LEB();
+ auto memIndex = getU32LEB();
+ if (memIndex != 0) {
+ throwError("nonzero memory index");
+ }
}
if (!curr.isPassive) {
curr.offset = readExpression();