New issue

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

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

Already on GitHub? Sign in to your account

net: fix abort on bad address input #13726

Closed
wants to merge 5 commits into
base: master
from

Conversation

@BridgeAR
Member

BridgeAR commented Jun 16, 2017

Calling net.createConnection with a bad path results in a segfault. This fixes this by checking for the type and by throwing a TypeError in case it's not a string.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

net

@addaleax

addaleax approved these changes Jun 16, 2017 edited

LGTM with the tiny nit I’d phrase the commit message as fix abort rather than fix segfault, because that’s what it is (at least on POSIX, but it shouldn’t be a segfault on Windows either)

Show outdated Hide outdated lib/net.js
Show outdated Hide outdated test/parallel/test-net-better-error-messages-path.js

@BridgeAR BridgeAR changed the title from net: fix segfault on bad address input to net: fix abort on bad address input Jun 16, 2017

@jasnell

This comment has been minimized.

Show comment
Hide comment
@jasnell

jasnell Jun 16, 2017

Member

Defensively marking as semver-major due to the new throw. Am argument could be made for patch tho because it would abort previously

Member

jasnell commented Jun 16, 2017

Defensively marking as semver-major due to the new throw. Am argument could be made for patch tho because it would abort previously

@addaleax

This comment has been minimized.

Show comment
Hide comment
@addaleax

addaleax Jun 16, 2017

Member

@jasnell I’m surprised … we tag error changes as semver-major because we know people might rely non-throwing behaviour, or existing errors and their messages, but I find it hard to believe people actively rely on processes aborting?

Member

addaleax commented Jun 16, 2017

@jasnell I’m surprised … we tag error changes as semver-major because we know people might rely non-throwing behaviour, or existing errors and their messages, but I find it hard to believe people actively rely on processes aborting?

@jasnell

This comment has been minimized.

Show comment
Hide comment
@jasnell

jasnell Jun 16, 2017

Member

It's not likely at all. As I said, an argument can be made that it's a patch, just need to make sure folks agree

Member

jasnell commented Jun 16, 2017

It's not likely at all. As I said, an argument can be made that it's a patch, just need to make sure folks agree

@BridgeAR

This comment has been minimized.

Show comment
Hide comment
@BridgeAR

BridgeAR Jun 16, 2017

Member

I agree that it is very unlikely that anyone would rely on that. It's actually already rare to trigger this in the first place and I think it would be good to backport this, if it's accepted as semver-patch.

Member

BridgeAR commented Jun 16, 2017

I agree that it is very unlikely that anyone would rely on that. It's actually already rare to trigger this in the first place and I think it would be good to backport this, if it's accepted as semver-patch.

Show outdated Hide outdated lib/net.js
@refack

refack approved these changes Jun 16, 2017

LGTM % moving the check

@refack

This comment has been minimized.

Show comment
Hide comment
Member

refack commented Jun 16, 2017

@refack

This comment has been minimized.

Show comment
Hide comment
Member

refack commented Jun 16, 2017

@refack

Error messages need assertion

Show outdated Hide outdated lib/internal/errors.js
Show outdated Hide outdated test/parallel/test-net-better-error-messages-path.js
Show outdated Hide outdated test/parallel/test-net-better-error-messages-path.js
@refack

This comment has been minimized.

Show comment
Hide comment
@refack

refack Jun 16, 2017

Member

3 tests fail
https://ci.nodejs.org/job/node-test-commit-linuxone/6689/nodes=rhel72-s390x/tapResults/
Just copied one:

917	parallel/test-process-cpuUsage	
duration_ms	0.58
severity	fail
stack	|-
assert.js:60
  throw new errors.AssertionError({
  ^

AssertionError [ERR_ASSERTION]: 'The "preValue.user" property must be of type Number' === 'The "preValue.user" argument must be of type Number'
    at Object.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/common/index.js:703:14)
    at expectedException (assert.js:520:19)
    at _throws (assert.js:568:8)
    at Function.throws (assert.js:577:3)
    at Object.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/parallel/test-process-cpuUsage.js:48:8)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
Member

refack commented Jun 16, 2017

3 tests fail
https://ci.nodejs.org/job/node-test-commit-linuxone/6689/nodes=rhel72-s390x/tapResults/
Just copied one:

917	parallel/test-process-cpuUsage	
duration_ms	0.58
severity	fail
stack	|-
assert.js:60
  throw new errors.AssertionError({
  ^

AssertionError [ERR_ASSERTION]: 'The "preValue.user" property must be of type Number' === 'The "preValue.user" argument must be of type Number'
    at Object.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/common/index.js:703:14)
    at expectedException (assert.js:520:19)
    at _throws (assert.js:568:8)
    at Function.throws (assert.js:577:3)
    at Object.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/parallel/test-process-cpuUsage.js:48:8)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)

BridgeAR added some commits Jun 16, 2017

@refack

refack approved these changes Jun 16, 2017

@refack

This comment has been minimized.

Show comment
Hide comment
Member

refack commented Jun 16, 2017

@refack refack self-assigned this Jun 17, 2017

@cjihrig

cjihrig approved these changes Jun 17, 2017 edited

LGTM as a semver patch with the comment addressed.

@lpinca

lpinca approved these changes Jun 17, 2017

@refack refack removed the semver-major label Jun 19, 2017

@refack

This comment has been minimized.

Show comment
Hide comment
@refack

refack Jun 19, 2017

Member

I see 3 CTC approvals, but still think it would be nice to have this as semver-patch
( from CTC I think I see +2 for patch and -0.1 from @jasnell )
Removing semver-major label, please feel free to correct me.

Member

refack commented Jun 19, 2017

I see 3 CTC approvals, but still think it would be nice to have this as semver-patch
( from CTC I think I see +2 for patch and -0.1 from @jasnell )
Removing semver-major label, please feel free to correct me.

@jasnell

This comment has been minimized.

Show comment
Hide comment
@jasnell

jasnell Jun 19, 2017

Member

There's no -0.1 from me at all. I marked it as a semver-major because of our policy, but I'm fine with it being a patch as long as there is consensus for doing so.

Member

jasnell commented Jun 19, 2017

There's no -0.1 from me at all. I marked it as a semver-major because of our policy, but I'm fine with it being a patch as long as there is consensus for doing so.

@refack

This comment has been minimized.

Show comment
Hide comment
@refack

refack Jun 19, 2017

Member

There's no -0.1 from me at all. I marked it as a semver-major because of our policy, but I'm fine with it being a patch as long as there is consensus for doing so.

Cool! I see consensus.
Planning to land in 3 hours.

Member

refack commented Jun 19, 2017

There's no -0.1 from me at all. I marked it as a semver-major because of our policy, but I'm fine with it being a patch as long as there is consensus for doing so.

Cool! I see consensus.
Planning to land in 3 hours.

refack added a commit to refack/node that referenced this pull request Jun 19, 2017

net: fix abort on bad address input
PR-URL: nodejs#13726
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@refack

This comment has been minimized.

Show comment
Hide comment
@refack

refack Jun 19, 2017

Member

Landed in f40caf7

Member

refack commented Jun 19, 2017

Landed in f40caf7

@refack refack closed this Jun 19, 2017

@refack

This comment has been minimized.

Show comment
Hide comment
@refack
Member

refack commented Jun 19, 2017

addaleax added a commit that referenced this pull request Jun 20, 2017

net: fix abort on bad address input
PR-URL: #13726
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

@addaleax addaleax referenced this pull request Jun 21, 2017

Merged

v8.2.0 proposal #13744

addaleax added a commit that referenced this pull request Jun 21, 2017

net: fix abort on bad address input
PR-URL: #13726
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

@addaleax addaleax referenced this pull request Jun 21, 2017

Merged

v8.1.3 proposal #13861

@MylesBorins

This comment has been minimized.

Show comment
Hide comment
@MylesBorins

MylesBorins Jul 17, 2017

Member

This does not land cleanly in LTS. Please feel free to manually backport. Please also feel free to replace the backport request label with do-not-land if it shouldn't land

Member

MylesBorins commented Jul 17, 2017

This does not land cleanly in LTS. Please feel free to manually backport. Please also feel free to replace the backport request label with do-not-land if it shouldn't land

BridgeAR added a commit to BridgeAR/node that referenced this pull request Jul 20, 2017

net: fix abort on bad address input
PR-URL: nodejs#13726
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

@BridgeAR BridgeAR referenced this pull request Jul 20, 2017

Closed

[v6.x backport] net: fix abort on bad address input #14390

4 of 4 tasks complete
@BridgeAR

This comment has been minimized.

Show comment
Hide comment
@BridgeAR

BridgeAR Jul 20, 2017

Member

I opened a PR with a backport for 6.x

Member

BridgeAR commented Jul 20, 2017

I opened a PR with a backport for 6.x

MylesBorins added a commit that referenced this pull request Sep 19, 2017

net: fix abort on bad address input
Backport-PR-URL: #14390
PR-URL: #13726
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

@MylesBorins MylesBorins referenced this pull request Sep 20, 2017

Merged

v6.11.4 proposal #15506

@BridgeAR BridgeAR deleted the BridgeAR:fix-segfault branch Apr 15, 2018

@BridgeAR BridgeAR restored the BridgeAR:fix-segfault branch Apr 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment