From 7d00f654bb3545beb5772f2f19768a48779e3db6 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 24 Mar 2021 10:31:01 -0700 Subject: [Wasm GC] Validate the number of arguments in struct.new (#3723) --- src/wasm/wasm-validator.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/wasm/wasm-validator.cpp') 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, -- cgit v1.2.3