Commit c1fd70b6 authored by Pierre Langlois's avatar Pierre Langlois Committed by Commit Bot

[heap] Add third-party heap guard in String::LooksValid().

Bug: v8:9533
Change-Id: Id888929b45a1519f4b4a4bb73159816520461841
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2534478
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71150}
parent fc24d04e
......@@ -439,6 +439,7 @@ bool String::LooksValid() {
// TODO(leszeks): Maybe remove this check entirely, Heap::Contains uses
// basically the same logic as the way we access the heap in the first place.
// RO_SPACE objects should always be valid.
if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) return true;
if (ReadOnlyHeap::Contains(*this)) return true;
BasicMemoryChunk* chunk = BasicMemoryChunk::FromHeapObject(*this);
if (chunk->heap() == nullptr) return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment