LibWasm: Respect instance.types() bounds

This commit is contained in:
Pavel Shliak 2024-12-08 19:58:50 +04:00 committed by Jelle Raaijmakers
parent 3c2bbd45cf
commit e08f6a69b2
Notes: github-actions[bot] 2024-12-09 11:31:30 +00:00

View file

@ -17,7 +17,7 @@ namespace Wasm {
Optional<FunctionAddress> Store::allocate(ModuleInstance& instance, Module const& module, CodeSection::Code const& code, TypeIndex type_index)
{
FunctionAddress address { m_functions.size() };
if (type_index.value() > instance.types().size())
if (type_index.value() >= instance.types().size())
return {};
auto& type = instance.types()[type_index.value()];