Skip to content

Commit ebee8ed

Browse files
ofrobotsgibfahn
authored andcommitted
deps: v8: fix potential segfault in profiler
This change fixes a potential segfault in the sampling heap profiler. This landed as part of a larger change upstream [1]. This is the minimal backport that avoids the segfault. [1]: https://git.io/vdTYL PR-URL: #15498 Backport-PR-URL: #16413 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent a7fc127 commit ebee8ed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

deps/v8/src/profiler/sampling-heap-profiler.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,11 @@ class SamplingAllocationObserver : public AllocationObserver {
172172
void Step(int bytes_allocated, Address soon_object, size_t size) override {
173173
USE(heap_);
174174
DCHECK(heap_->gc_state() == Heap::NOT_IN_GC);
175-
DCHECK(soon_object);
176-
profiler_->SampleObject(soon_object, size);
175+
if (soon_object) {
176+
// TODO(ofrobots): it would be better to sample the next object rather
177+
// than skipping this sample epoch if soon_object happens to be null.
178+
profiler_->SampleObject(soon_object, size);
179+
}
177180
}
178181

179182
intptr_t GetNextStepSize() override { return GetNextSampleInterval(rate_); }

0 commit comments

Comments
 (0)