1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:07:45 +00:00

LibJS: Do not invoke Cell::vm in constructors before Cell is constructed

In a subclass of Cell, we cannot use Cell::vm() before the base Cell
object itself is constructed. Use the Realm's VM instead.

This was caught by UBSAN with vptr sanitation enabled.
This commit is contained in:
Timothy Flynn 2022-09-14 19:10:27 -04:00 committed by Andreas Kling
parent 3efe611dbf
commit 85e313077a
46 changed files with 97 additions and 97 deletions

View file

@ -12,7 +12,7 @@ namespace JS::Temporal {
// 12.2 The Temporal.Calendar Constructor, https://tc39.es/proposal-temporal/#sec-temporal-calendar-constructor
CalendarConstructor::CalendarConstructor(Realm& realm)
: NativeFunction(vm().names.Calendar.as_string(), *realm.intrinsics().function_prototype())
: NativeFunction(realm.vm().names.Calendar.as_string(), *realm.intrinsics().function_prototype())
{
}

View file

@ -15,7 +15,7 @@ namespace JS::Temporal {
// 7.1 The Temporal.Duration Constructor, https://tc39.es/proposal-temporal/#sec-temporal-duration-constructor
DurationConstructor::DurationConstructor(Realm& realm)
: NativeFunction(vm().names.Duration.as_string(), *realm.intrinsics().function_prototype())
: NativeFunction(realm.vm().names.Duration.as_string(), *realm.intrinsics().function_prototype())
{
}

View file

@ -14,7 +14,7 @@ namespace JS::Temporal {
// 8.1 The Temporal.Instant Constructor, https://tc39.es/proposal-temporal/#sec-temporal-instant-constructor
InstantConstructor::InstantConstructor(Realm& realm)
: NativeFunction(vm().names.Instant.as_string(), *realm.intrinsics().function_prototype())
: NativeFunction(realm.vm().names.Instant.as_string(), *realm.intrinsics().function_prototype())
{
}

View file

@ -16,7 +16,7 @@ namespace JS::Temporal {
// 3.1 The Temporal.PlainDate Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plaindate-constructor
PlainDateConstructor::PlainDateConstructor(Realm& realm)
: NativeFunction(vm().names.PlainDate.as_string(), *realm.intrinsics().function_prototype())
: NativeFunction(realm.vm().names.PlainDate.as_string(), *realm.intrinsics().function_prototype())
{
}

View file

@ -16,7 +16,7 @@ namespace JS::Temporal {
// 5.1 The Temporal.PlainDateTime Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plaindatetime-constructor
PlainDateTimeConstructor::PlainDateTimeConstructor(Realm& realm)
: NativeFunction(vm().names.PlainDateTime.as_string(), *realm.intrinsics().function_prototype())
: NativeFunction(realm.vm().names.PlainDateTime.as_string(), *realm.intrinsics().function_prototype())
{
}

View file

@ -15,7 +15,7 @@ namespace JS::Temporal {
// 10.1 The Temporal.PlainMonthDay Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plainmonthday-constructor
PlainMonthDayConstructor::PlainMonthDayConstructor(Realm& realm)
: NativeFunction(vm().names.PlainMonthDay.as_string(), *realm.intrinsics().function_prototype())
: NativeFunction(realm.vm().names.PlainMonthDay.as_string(), *realm.intrinsics().function_prototype())
{
}

View file

@ -14,7 +14,7 @@ namespace JS::Temporal {
// 4.1 The Temporal.PlainTime Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plaintime-constructor
PlainTimeConstructor::PlainTimeConstructor(Realm& realm)
: NativeFunction(vm().names.PlainTime.as_string(), *realm.intrinsics().function_prototype())
: NativeFunction(realm.vm().names.PlainTime.as_string(), *realm.intrinsics().function_prototype())
{
}

View file

@ -16,7 +16,7 @@ namespace JS::Temporal {
// 9.1 The Temporal.PlainYearMonth Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plainyearmonth-constructor
PlainYearMonthConstructor::PlainYearMonthConstructor(Realm& realm)
: NativeFunction(vm().names.PlainYearMonth.as_string(), *realm.intrinsics().function_prototype())
: NativeFunction(realm.vm().names.PlainYearMonth.as_string(), *realm.intrinsics().function_prototype())
{
}

View file

@ -12,7 +12,7 @@ namespace JS::Temporal {
// 11.2 The Temporal.TimeZone Constructor, https://tc39.es/proposal-temporal/#sec-temporal-timezone-constructor
TimeZoneConstructor::TimeZoneConstructor(Realm& realm)
: NativeFunction(vm().names.TimeZone.as_string(), *realm.intrinsics().function_prototype())
: NativeFunction(realm.vm().names.TimeZone.as_string(), *realm.intrinsics().function_prototype())
{
}

View file

@ -17,7 +17,7 @@ namespace JS::Temporal {
// 6.1 The Temporal.ZonedDateTime Constructor, https://tc39.es/proposal-temporal/#sec-temporal-zoneddatetime-constructor
ZonedDateTimeConstructor::ZonedDateTimeConstructor(Realm& realm)
: NativeFunction(vm().names.ZonedDateTime.as_string(), *realm.intrinsics().function_prototype())
: NativeFunction(realm.vm().names.ZonedDateTime.as_string(), *realm.intrinsics().function_prototype())
{
}