LibJS: Set empty function parameters on ClassStaticInit scope

This prevents the variables declared inside a class static initializer
to escape to the nearest containing function causing all sorts of memory
corruptions.
This commit is contained in:
devgianlu 2025-03-11 11:15:07 +01:00 committed by Luke Wilde
parent 6aea459e00
commit 08cfd5ff1b
Notes: github-actions[bot] 2025-04-05 17:21:29 +00:00
2 changed files with 19 additions and 0 deletions

View file

@ -1537,6 +1537,8 @@ NonnullRefPtr<ClassExpression const> Parser::parse_class_expression(bool expect_
{
ScopePusher static_init_scope = ScopePusher::static_init_block_scope(*this, *static_init_block);
static_init_scope.set_function_parameters(FunctionParameters::empty());
parse_statement_list(static_init_block);
}