From 883b2268c07ce1846c44696a0083e28beedefa76 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 22 Feb 2024 13:22:35 +0100 Subject: [PATCH] LibJS: Protect private elements from GC during class construction Fixes an issue caught by test-js -g + UBSAN. --- Userland/Libraries/LibJS/AST.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index b6d8e878a9..640ada3fde 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2023, Andreas Kling + * Copyright (c) 2020-2024, Andreas Kling * Copyright (c) 2020-2023, Linus Groh * Copyright (c) 2021-2022, David Tuin * @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -372,8 +373,8 @@ ThrowCompletionOr ClassExpression::create_class_const using StaticElement = Variant>; - Vector static_private_methods; - Vector instance_private_methods; + ConservativeVector static_private_methods(vm.heap()); + ConservativeVector instance_private_methods(vm.heap()); Vector instance_fields; Vector static_elements;