LibWasm: Validate indirect calls at runtime

This is required by the spec, and also unbreaks all of the call-indirect
wpt tests.
This commit is contained in:
Ali Mohammad Pur 2025-05-21 16:16:28 +02:00 committed by Tim Ledbetter
parent 39b637a446
commit d79d5b70a5
Notes: github-actions[bot] 2025-05-22 06:37:18 +00:00
2 changed files with 18 additions and 3 deletions

View file

@ -47,6 +47,11 @@ struct BytecodeInterpreter : public Interpreter {
BytecodeInterpreter& m_interpreter;
};
enum class CallAddressSource {
DirectCall,
IndirectCall,
};
protected:
void interpret_instruction(Configuration&, InstructionPointer&, Instruction const&);
void branch_to_label(Configuration&, LabelIndex);
@ -71,7 +76,7 @@ protected:
template<typename M, template<typename> typename SetSign, typename VectorType = Native128ByteVectorOf<M, SetSign>>
VectorType pop_vector(Configuration&);
void store_to_memory(Configuration&, Instruction::MemoryArgument const&, ReadonlyBytes data, u32 base);
void call_address(Configuration&, FunctionAddress);
void call_address(Configuration&, FunctionAddress, CallAddressSource = CallAddressSource::DirectCall);
template<typename PopTypeLHS, typename PushType, typename Operator, typename PopTypeRHS = PopTypeLHS, typename... Args>
void binary_numeric_operation(Configuration&, Args&&...);