LibWasm: Reject indirect calls to external function references

This fixes a test in the WebAssembly spec test suite that was
added in 924c1f816d
This commit is contained in:
Andrew Kaster 2024-10-14 17:58:48 -06:00 committed by Andrew Kaster
commit a3157c8c69
Notes: github-actions[bot] 2024-10-15 00:15:08 +00:00

View file

@ -2109,8 +2109,8 @@ VALIDATE_INSTRUCTION(call_indirect)
TRY(validate(args.type));
auto& table = m_context.tables[args.table.value()];
if (!table.element_type().is_reference())
return Errors::invalid("table element type for call.indirect"sv, "a reference type"sv, table.element_type());
if (table.element_type().kind() != ValueType::FunctionReference)
return Errors::invalid("table element type for call.indirect"sv, "a function reference"sv, table.element_type());
auto& type = m_context.types[args.type.value()];