diff options
author | Thomas Lively <tlively@google.com> | 2024-06-18 18:35:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-18 18:35:30 -0700 |
commit | eceb0fb6ac097e262bf74dcdb686cfc5d4c55188 (patch) | |
tree | 305ec69254bc6d09de771ba2e94c572f280176db /src/wasm | |
parent | 02c4c3cd43a2033a7fd2f5c75f6d92ac9b80bb4b (diff) | |
download | binaryen-eceb0fb6ac097e262bf74dcdb686cfc5d4c55188.tar.gz binaryen-eceb0fb6ac097e262bf74dcdb686cfc5d4c55188.tar.bz2 binaryen-eceb0fb6ac097e262bf74dcdb686cfc5d4c55188.zip |
Check malformed mutability on imported globals (#6679)
And re-enable the globals.wast spec test, which checks this.
Diffstat (limited to 'src/wasm')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 01b3602eb..cd1ca7dfd 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -2591,6 +2591,9 @@ void WasmBinaryReader::readImports() { Name name(std::string("gimport$") + std::to_string(globalCounter++)); auto type = getConcreteType(); auto mutable_ = getU32LEB(); + if (mutable_ & ~1) { + throwError("Global mutability must be 0 or 1"); + } auto curr = builder.makeGlobal(name, type, |