Issue #2172 - add null zone sanity checks

This commit is contained in:
Martok 2023-08-09 22:41:30 +02:00 • committed by roytam1
commit dc5702a0f2
2 changed files with 5 additions and 1 deletions

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 // 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 // faster to check our own arena, which we can do since we know that
// the object is tenured. // the object is tenured.
return obj->asTenured().zone()->shouldMarkInZone(); Zone* zone = obj->asTenured().zone();
return (zone && zone->shouldMarkInZone());
} }
template <typename T> template <typename T>

View file

@ -877,6 +877,9 @@ js::CurrentThreadCanAccessRuntime(const JSRuntime* rt)
bool bool
js::CurrentThreadCanAccessZone(Zone* zone) js::CurrentThreadCanAccessZone(Zone* zone)
{ {
if (!zone)
return false;
if (CurrentThreadCanAccessRuntime(zone->runtime_)) if (CurrentThreadCanAccessRuntime(zone->runtime_))
return true; return true;