summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-03-24 10:31:01 -0700
committerGitHub <noreply@github.com>2021-03-24 10:31:01 -0700
commit7d00f654bb3545beb5772f2f19768a48779e3db6 (patch)
tree91a6ca8dad4351911ff84fe7e636f0c4c063c6f4 /src
parentffac06650507ac413d60d72aadc1e33fb1f91ccf (diff)
downloadbinaryen-7d00f654bb3545beb5772f2f19768a48779e3db6.tar.gz
binaryen-7d00f654bb3545beb5772f2f19768a48779e3db6.tar.bz2
binaryen-7d00f654bb3545beb5772f2f19768a48779e3db6.zip
[Wasm GC] Validate the number of arguments in struct.new (#3723)
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-validator.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 52ba36872..b49b4bb0f 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -2299,6 +2299,10 @@ void FunctionValidator::visitStructNew(StructNew* curr) {
"struct.new_with_default value type must be defaultable");
}
} else {
+ shouldBeEqual(curr->operands.size(),
+ fields.size(),
+ curr,
+ "struct.new must have the right number of operands");
// All the fields must have the proper type.
for (Index i = 0; i < fields.size(); i++) {
shouldBeSubType(curr->operands[i]->type,