Compare commits

...
Author SHA1 Message Date
Moonchild 6971a3a477 Issue #2172 - add Zone null checks. 2023-08-04 20:28:01 +02:00
3 changed files with 9 additions and 3 deletions

No files matched your search

+4 -2
View File
@@ -1280,8 +1280,10 @@ JS::Zone*
TenuredCell::zone() const
{
JS::Zone* zone = arena()->zone;
MOZ_ASSERT(CurrentThreadCanAccessZone(zone));
return zone;
if (CurrentThreadCanAccessZone(zone))
return zone;
return nullptr;
}
JS::Zone*
+2 -1
View File
@@ -788,7 +788,8 @@ ShouldMark<JSObject*>(GCMarker* gcmarker, JSObject* obj)
// Don't mark things outside a zone if we are in a per-zone GC. It is
// faster to check our own arena, which we can do since we know that
// the object is tenured.
return obj->asTenured().zone()->shouldMarkInZone();
Zone* zone = obj->asTenured().zone();
return (zone && zone->shouldMarkInZone());
}
template <typename T>
+3
View File
@@ -877,6 +877,9 @@ js::CurrentThreadCanAccessRuntime(const JSRuntime* rt)
bool
js::CurrentThreadCanAccessZone(Zone* zone)
{
if (!zone)
return false;
if (CurrentThreadCanAccessRuntime(zone->runtime_))
return true;