Skip to content

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

Closed

Description

@zyscoder

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

Activity

  1. added
    tls
    on Apr 7, 2021
  2. changed the title [-]`TLSSocket.prependOnceListener` results in a segmentation fault[/-] [+]`TLSSocket.prependOnceListener('keylog')` results in a segmentation fault[/+] on Apr 7, 2021
  3. added
    confirmed-bug
    repl
    on Apr 7, 2021
  4. aduh95 commented on Apr 7, 2021

    @aduh95
    Contributor

    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.

  5. removed
    repl
    on Apr 7, 2021
  6. addaleax commented on Apr 7, 2021

    @addaleax
    Member

    Not related to the REPL.

    const tls = require('tls');
    tlsSocket = tls.connect('r','\u{85}');
    tlsSocket.on('error', () => {})
    setTimeout(() => {
    tlsSocket.prependOnceListener('keylog',(line)=>{});
    }, 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugtls

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions