Skip to content

DNS lookupService fails with internal C error when given a string port number. #4837

@rgrannell1

Description

@rgrannell1

The DNS module's lookupService method throws an unwrapped C error when given a string for a port number. This isn't ideal; preferably a TypeError would be thrown instead, or the function would just parse the string to an integer.

The following error messages is given for the failing test cases shown below.

node: ../src/cares_wrap.cc:1098: void node::cares_wrap::GetNameInfo(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `args[2]->IsUint32()' failed.
Aborted

If I'm missing any important information, please tell me and I'll update this issue.

Environment:

  • Node v5.4.1
  • Npm 3.5.3
  • Linux 4.2.0-23-generic (Ubuntu)

Test-Case:

Failing Test Cases:

require('dns').lookupService('0.0.0.0', '0', (err, hostname, service) => {

})

require('dns').lookupService('127.0.0.1', '443', (err, hostname, service) => {

})

Control Test Cases:

Both these cases behave normally; they don't throw a C error.

require('dns').lookupService('0.0.0.0', 0, (err, hostname, service) => {

})

require('dns').lookupService('127.0.0.1', 443, (err, hostname, service) => {

})

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions