diff options
author | Ali Ijaz Sheikh <ofrobots@google.com> | 2017-09-20 10:08:26 -0700 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2017-10-18 17:05:11 -0700 |
commit | 33f5014b373c567cbf2e79328624c313618eb8a2 (patch) | |
tree | 6b0254bd122b0422220b82fed4b30acb01c69df7 /deps | |
parent | d7456ab2ebb3d4c45deb09420271f0da437685f8 (diff) | |
download | android-node-v8-33f5014b373c567cbf2e79328624c313618eb8a2.tar.gz android-node-v8-33f5014b373c567cbf2e79328624c313618eb8a2.tar.bz2 android-node-v8-33f5014b373c567cbf2e79328624c313618eb8a2.zip |
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: https://github.com/nodejs/node/pull/15498
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps')
-rw-r--r-- | deps/v8/src/profiler/sampling-heap-profiler.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/deps/v8/src/profiler/sampling-heap-profiler.h b/deps/v8/src/profiler/sampling-heap-profiler.h index 07840244ce..3a347dd54e 100644 --- a/deps/v8/src/profiler/sampling-heap-profiler.h +++ b/deps/v8/src/profiler/sampling-heap-profiler.h @@ -172,8 +172,11 @@ class SamplingAllocationObserver : public AllocationObserver { void Step(int bytes_allocated, Address soon_object, size_t size) override { USE(heap_); DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); - DCHECK(soon_object); - profiler_->SampleObject(soon_object, size); + if (soon_object) { + // TODO(ofrobots): it would be better to sample the next object rather + // than skipping this sample epoch if soon_object happens to be null. + profiler_->SampleObject(soon_object, size); + } } intptr_t GetNextStepSize() override { return GetNextSampleInterval(rate_); } |