node-pty icon indicating copy to clipboard operation
node-pty copied to clipboard

Core Dump in Debug Build Due to Improper HandleScope Usage in PtyFork

Open zhangbonian opened this issue 11 months ago • 1 comments
trafficstars

Title:

Description: When building this package in debug mode, the vscode pty host crashes with a core dump. The root cause was identified as improper usage of HandleScope in the PtyFork implementation as well as in some others.

Issue Details:

  • The current implementation attempts to return a value from HandleScope
  • HandleScope-managed objects are automatically destroyed when the function returns
  • This leads to accessing destroyed objects, resulting in a core dump

Suggestion: Replace the current HandleScope with Napi::EscapableHandleScope to properly manage object lifetime:

I'm not a node expert. The solution needs futher check by someone.

Thanks

zhangbonian avatar Nov 25 '24 03:11 zhangbonian

Can you share the test case that resulted in crash, it would help to resolve this issue. Thanks!

deepak1556 avatar Dec 17 '24 18:12 deepak1556