File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -501,10 +501,19 @@ impl OperatorValidator {
501501 table_index : u32 ,
502502 resources : & impl WasmModuleResources ,
503503 ) -> OperatorValidatorResult < ( ) > {
504- if resources. table_at ( table_index) . is_none ( ) {
505- return Err ( OperatorValidatorError :: new (
506- "unknown table: table index out of bounds" ,
507- ) ) ;
504+ match resources. table_at ( table_index) {
505+ None => {
506+ return Err ( OperatorValidatorError :: new (
507+ "unknown table: table index out of bounds" ,
508+ ) ) ;
509+ }
510+ Some ( tab) => {
511+ if tab. element_type != Type :: FuncRef {
512+ return Err ( OperatorValidatorError :: new (
513+ "indirect calls must go through a table of funcref" ,
514+ ) ) ;
515+ }
516+ }
508517 }
509518 let ty = func_type_at ( & resources, index) ?;
510519 self . pop_operand ( Some ( Type :: I32 ) ) ?;
Original file line number Diff line number Diff line change 1+ (assert_malformed
2+ (module
3+ (type (func (result i32 )))
4+ (func $main (result i32 )
5+ i32.const 0
6+ call_indirect (type 0 )
7+ )
8+ (table (;0;) 1 externref )
9+ )
10+ " indirect calls must go through a table of funcref"
11+ )
You can’t perform that action at this time.
0 commit comments