LibWasm: Report start function traps during instantiation

This commit is contained in:
Diego 2024-06-16 07:11:49 -07:00 committed by Ali Mohammad Pur
parent 1e19be412f
commit c2a0c4f581
Notes: sideshowbarker 2024-07-17 01:51:00 +09:00

View file

@ -425,7 +425,9 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
instantiation_result = InstantiationError { ByteString::formatted("Start section function referenced invalid index {} of max {} entries", index.value(), functions.size()) };
return;
}
invoke(functions[index.value()], {});
auto result = invoke(functions[index.value()], {});
if (result.is_trap())
instantiation_result = InstantiationError { ByteString::formatted("Start function trapped: {}", result.trap().reason) };
});
if (instantiation_result.has_value())