Skip to content

Commit

Permalink
LibWasm: Reject indirect calls to external function references
Browse files Browse the repository at this point in the history
This fixes a test in the WebAssembly spec test suite that was
added in WebAssembly/spec@924c1f8
  • Loading branch information
ADKaster committed Oct 15, 2024
1 parent c4f7361 commit a3157c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Userland/Libraries/LibWasm/AbstractMachine/Validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()];

Expand Down

0 comments on commit a3157c8

Please sign in to comment.