Skip to content

Coredump when passing undefined as address from custom lookup function #34812

Closed
@joepie91

Description

@joepie91

What steps will reproduce the bug?

"use strict";

const http = require("http");

http.get({
	host: "google.com:80",
	path: "/",
	lookup: function (host, options, callback) {
		callback(null, undefined, 4);
		// Note the `undefined` here instead of an IP!
	}
});

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

Completely reproducible.

What is the expected behavior?

Should produce a (catchable/handleable) error indicating that an invalid value was passed from lookup rather than aborting, since this is public API.

What do you see instead?

node[18969]: ../src/tcp_wrap.cc:312:static void node::TCPWrap::Connect(const v8::FunctionCallbackInfo<v8::Value>&, std::function<int(const char*, T*)>) [with T = sockaddr_in]: Assertion `args[1]->IsString()' failed.
 1: 0x9345f8 node::Abort() [node]
 2: 0x934691  [node]
 3: 0x9fda20 void node::TCPWrap::Connect<sockaddr_in>(v8::FunctionCallbackInfo<v8::Value> const&, std::function<int (char const*, sockaddr_in*)>) [node]
 4: 0x9fc95c node::TCPWrap::Connect(v8::FunctionCallbackInfo<v8::Value> const&) [node]
 5: 0xb0e819 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [node]
 6: 0xb0ebd0  [node]
 7: 0xb0fa6a  [node]
 8: 0xb0fcf9 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
 9: 0x12af4f9  [node]
Aborted (core dumped)

Additional information

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.dnsIssues and PRs related to the dns subsystem.httpIssues or PRs related to the http subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions