Skip to content

Commit eceb0fb

Browse files
authored
Check malformed mutability on imported globals (#6679)
And re-enable the globals.wast spec test, which checks this.
1 parent 02c4c3c commit eceb0fb

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

scripts/test/shared.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ def get_tests(test_dir, extensions=[], recursive=False):
400400
# expected-output/ if any.
401401
SPEC_TESTS_TO_SKIP = [
402402
# Malformed module accepted
403-
'globals.wast',
404403
'binary-leb128.wast',
405404
'utf8-custom-section-id.wast',
406405
'utf8-import-field.wast',

src/wasm/wasm-binary.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2591,6 +2591,9 @@ void WasmBinaryReader::readImports() {
25912591
Name name(std::string("gimport$") + std::to_string(globalCounter++));
25922592
auto type = getConcreteType();
25932593
auto mutable_ = getU32LEB();
2594+
if (mutable_ & ~1) {
2595+
throwError("Global mutability must be 0 or 1");
2596+
}
25942597
auto curr =
25952598
builder.makeGlobal(name,
25962599
type,

0 commit comments

Comments
 (0)