node-inspector / v8-profiler

node bindings for the v8 profiler
BSD 2-Clause "Simplified" License
1.13k stars 134 forks source link

Segfault if stopProfiling called when not profiling #102

Open cxreg opened 7 years ago

cxreg commented 7 years ago

Obviously this is not something a user should do but it should throw an exception instead of segfaulting.

The problem appears to be at https://github.com/node-inspector/v8-profiler/blob/master/src/cpu_profiler.cc#L54 where profile will be NULL if v8 didn't think a profile was running when asked to stop. This then manifests as a null pointer dereference at https://github.com/node-inspector/v8-profiler/blob/master/src/cpu_profile.cc#L65