mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-04 17:33:04 +00:00
LibJS/Bytecode: Do a stack check when entering run_bytecode()
If we don't have enough stack space, throw an exception while we still can, and give the caller a chance to recover. This particular problem will go away once we make calls non-recursive.
This commit is contained in:
parent
ebe6ec6069
commit
a020a0779d
Notes:
sideshowbarker
2024-07-17 05:05:51 +09:00
Author: https://github.com/awesomekling
Commit: a020a0779d
Pull-request: https://github.com/SerenityOS/serenity/pull/24240
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 5 additions and 0 deletions
|
@ -339,6 +339,11 @@ Interpreter::HandleExceptionResponse Interpreter::handle_exception(size_t& progr
|
|||
|
||||
FLATTEN_ON_CLANG void Interpreter::run_bytecode(size_t entry_point)
|
||||
{
|
||||
if (vm().did_reach_stack_space_limit()) {
|
||||
reg(Register::exception()) = vm().throw_completion<InternalError>(ErrorType::CallStackSizeExceeded).release_value().value();
|
||||
return;
|
||||
}
|
||||
|
||||
auto& running_execution_context = vm().running_execution_context();
|
||||
auto* locals = running_execution_context.locals.data();
|
||||
auto& accumulator = this->accumulator();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue