1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00

LibWasm+LibWeb: Throw a js stack-overflow error if wasm stack overflows

Follows the spec.
This commit is contained in:
Ali Mohammad Pur 2025-05-21 16:15:34 +02:00 committed by Tim Ledbetter
parent 9ae85e5c68
commit 39b637a446
Notes: github-actions[bot] 2025-05-22 06:37:26 +00:00
4 changed files with 20 additions and 4 deletions

View file

@ -22,9 +22,9 @@ using namespace AK::SIMD;
namespace Wasm {
#define TRAP_IF_NOT(x) \
#define TRAP_IF_NOT(x, ...) \
do { \
if (trap_if_not(x, #x##sv)) { \
if (trap_if_not(x, #x##sv __VA_OPT__(, ) __VA_ARGS__)) { \
dbgln_if(WASM_TRACE_DEBUG, "Trapped because {} failed, at line {}", #x, __LINE__); \
return; \
} \
@ -225,7 +225,7 @@ VectorType BytecodeInterpreter::pop_vector(Configuration& configuration)
void BytecodeInterpreter::call_address(Configuration& configuration, FunctionAddress address)
{
TRAP_IF_NOT(m_stack_info.size_free() >= Constants::minimum_stack_space_to_keep_free);
TRAP_IF_NOT(m_stack_info.size_free() >= Constants::minimum_stack_space_to_keep_free, "{}: {}", Constants::stack_exhaustion_message);
auto instance = configuration.store().get(address);
FunctionType const* type { nullptr };