Skip to content

Commit f22132e

Browse files
ofrobotsMylesBorins
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 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 1483ebd commit f22132e

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
@@ -146,8 +146,11 @@ class SamplingAllocationObserver : public AllocationObserver {
146146
void Step(int bytes_allocated, Address soon_object, size_t size) override {
147147
USE(heap_);
148148
DCHECK(heap_->gc_state() == Heap::NOT_IN_GC);
149-
DCHECK(soon_object);
150-
profiler_->SampleObject(soon_object, size);
149+
if (soon_object) {
150+
// TODO(ofrobots): it would be better to sample the next object rather
151+
// than skipping this sample epoch if soon_object happens to be null.
152+
profiler_->SampleObject(soon_object, size);
153+
}
151154
}
152155

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

0 commit comments

Comments
 (0)