Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TLSSocket.prependOnceListener('keylog') results in a segmentation fault #38133

Closed
zyscoder opened this issue Apr 7, 2021 · 2 comments
Closed
Labels
confirmed-bug Issues with confirmed bugs. tls Issues and PRs related to the tls subsystem.

Comments

@zyscoder
Copy link

zyscoder commented Apr 7, 2021

What steps will reproduce the bug?

Setup a node instance,

» node

and run the following javascript code.

tlsSocket = tls.connect('r','\u{85}');
tlsSocket.prependOnceListener('keylog',(line)=>{});

Then a segmentation fault occurs.

How often does it reproduce? Is there a required condition?

This problem can always be triggered following the steps above.

What is the expected behavior?

If any error occurs, an exception or other similar error-reporting stuff should be thrown. There is no reason to abort the whole node process.

What do you see instead?

» node
Welcome to Node.js v14.15.1.
Type ".help" for more information.
> tlsSocket = tls.connect('r','\u{85}');
<ref *1> TLSSocket {
...
}
> tlsSocket.prependOnceListener('keylog',(line)=>{});Uncaught:
<ref *1> Error: connect ENOENT r
...
}
> tlsSocket.prependOnceListener('keylog',(line)=>{});
[1]    210623 segmentation fault (core dumped)  node

Additional information

@Ayase-252 Ayase-252 added the tls Issues and PRs related to the tls subsystem. label Apr 7, 2021
@zyscoder zyscoder changed the title TLSSocket.prependOnceListener results in a segmentation fault TLSSocket.prependOnceListener('keylog') results in a segmentation fault Apr 7, 2021
@aduh95 aduh95 added confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem. labels Apr 7, 2021
@aduh95
Copy link
Contributor

aduh95 commented Apr 7, 2021

Can reproduce on master and v14.x, but only in REPL: cannot reproduce with eval (node -e, node -p, echo | node) or when inside a file.

@addaleax addaleax removed the repl Issues and PRs related to the REPL subsystem. label Apr 7, 2021
@addaleax
Copy link
Member

addaleax commented Apr 7, 2021

Not related to the REPL.

const tls = require('tls');
tlsSocket = tls.connect('r','\u{85}');
tlsSocket.on('error', () => {})
setTimeout(() => {
tlsSocket.prependOnceListener('keylog',(line)=>{});
}, 1000)

Linkgoron added a commit to Linkgoron/node that referenced this issue Apr 9, 2021
Fix an issue where adding a session or keylog listener
on a tlsSocket caused an abort.

fixes: nodejs#38133
fixes: nodejs#38135
Linkgoron added a commit to Linkgoron/node that referenced this issue Apr 9, 2021
Fix an issue where adding a session or keylog listener on a tlsSocket
after it was destroyed caused a segfault.

fixes: nodejs#38133
fixes: nodejs#38135
Linkgoron added a commit to Linkgoron/node that referenced this issue Apr 9, 2021
Fix an issue where adding a session or keylog listener on a tlsSocket
after it was destroyed caused a segfault.

fixes: nodejs#38133
fixes: nodejs#38135
Linkgoron added a commit to Linkgoron/node that referenced this issue Apr 9, 2021
Fix an issue where adding a session or keylog listener on a tlsSocket
after it was destroyed caused a segfault.

fixes: nodejs#38133
fixes: nodejs#38135
Linkgoron added a commit to Linkgoron/node that referenced this issue Apr 9, 2021
Fix an issue where adding a session or keylog listener on a tlsSocket
after it was destroyed caused a segfault.

fixes: nodejs#38133
fixes: nodejs#38135
BethGriggs pushed a commit that referenced this issue Apr 15, 2021
Fix an issue where adding a session or keylog listener on a tlsSocket
after it was destroyed caused a segfault.

fixes: #38133
fixes: #38135

PR-URL: #38180
Fixes: #38133
Fixes: #38135
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit that referenced this issue May 30, 2021
Fix an issue where adding a session or keylog listener on a tlsSocket
after it was destroyed caused a segfault.

fixes: #38133
fixes: #38135

PR-URL: #38180
Fixes: #38133
Fixes: #38135
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit that referenced this issue Jun 5, 2021
Fix an issue where adding a session or keylog listener on a tlsSocket
after it was destroyed caused a segfault.

fixes: #38133
fixes: #38135

PR-URL: #38180
Fixes: #38133
Fixes: #38135
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit that referenced this issue Jun 11, 2021
Fix an issue where adding a session or keylog listener on a tlsSocket
after it was destroyed caused a segfault.

fixes: #38133
fixes: #38135

PR-URL: #38180
Fixes: #38133
Fixes: #38135
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
confirmed-bug Issues with confirmed bugs. tls Issues and PRs related to the tls subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants