Skip to content

Commit 5a17afc

Browse files
authored
Validate features used by block return types (#7197)
We previously checked only for the multivalue feature when used by blocks, but now check for all used features. This will fix a current fuzzer error where the new unreachable-string-new.wast test validates with shared-everything disabled even though it uses shared heap types, allowing the fuzzer to use those shared types in other places that are checked by the validator.
1 parent e276453 commit 5a17afc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/wasm/wasm-validator.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -675,11 +675,11 @@ void FunctionValidator::validatePoppyExpression(Expression* curr) {
675675
}
676676

677677
void FunctionValidator::visitBlock(Block* curr) {
678-
if (!getModule()->features.hasMultivalue()) {
679-
shouldBeTrue(
680-
!curr->type.isTuple(),
681-
curr,
682-
"Multivalue block type require multivalue [--enable-multivalue]");
678+
auto feats = curr->type.getFeatures();
679+
if (!shouldBeTrue(feats <= getModule()->features,
680+
curr,
681+
"Block type requires additional features")) {
682+
getStream() << getMissingFeaturesList(*getModule(), feats) << '\n';
683683
}
684684
// if we are break'ed to, then the value must be right for us
685685
if (curr->name.is()) {

test/unit/test_features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def test_multivalue_block(self):
252252
)
253253
)
254254
'''
255-
self.check_multivalue(module, 'Multivalue block type require multivalue [--enable-multivalue]')
255+
self.check_multivalue(module, 'Block type requires additional features')
256256

257257
def test_i31_global(self):
258258
module = '''

0 commit comments

Comments
 (0)