Skip to content

net.connect: crashes when custom lookup returns invalid address type #19407

@targos

Description

@targos

Test case:

require('net').connect({host: 'localhost', port: 80, lookup: (_, __, cb) => cb(null, '127.0.0.1', 100)});
> require('net').connect({host: 'localhost', port: 80, lookup: (_, __, cb) => cb(null, '127.0.0.1', 100)})
./node[15685]: ../src/tcp_wrap.cc:281:static void node::TCPWrap::Connect(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `args[2]->IsUint32()' failed.
 1: node::Abort() [./node]
 2: 0x87f17f [./node]
 3: node::TCPWrap::Connect(v8::FunctionCallbackInfo<v8::Value> const&) [./node]
 4: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [./node]
 5: 0xadb6c9 [./node]
 6: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [./node]
 7: 0x14efa198427d
[1]    15685 abort (core dumped)  ./node

Metadata

Metadata

Assignees

No one assigned

    Labels

    netIssues and PRs related to the net subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions