FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix windows segfault by Kelmar · Pull Request #6938 · nodejs/node · GitHub

/ node Public

Fix windows segfault - #6938

Closed
Kelmar wants to merge 6 commits into
nodejs:masterfrom
Kelmar:arg_segfault_fix_2
Closed

Fix windows segfault#6938
Kelmar wants to merge 6 commits into
nodejs:masterfrom
Kelmar:arg_segfault_fix_2

Conversation

Kelmar commented May 23, 2016
edited
Loading

Copy link
Copy Markdown

Fix for Windows Segfault with missing arguments.

Platform: Windows
Arch: x64
Compiler: VC2015

When specifying a parameter that requires an additional argument on the
command line, node would segfault. This appears to be specific to
Windows, adjusted command line argument parsing to hold a nullptr
terminal.

Take two of the fix, based on feedback from @addaleax

Arch: x64
Compiler: VC2015

When specifing a parameter that requries an additional argument on the
command line, node would segfault.  This appears to be specific to
Windows, adjusted command line argument parsing to hold a nullptr
terminal.
nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label May 23, 2016
addaleax mentioned this pull request May 23, 2016

Copy link
Copy Markdown
Member

The code changes looks good. I don’t know if you’ve read your way through the contributing guidlines, but a couple of things things that would be awesome here:

  • Ideally, there would be a regression test added in this PR. You can take a look at e.g. test/parallel/test-cli-eval.js and see if you can add a similar test there, where you invoke only node -e.
  • The commit message would need to look a bit more like specified in the guidelines, i.e. there would be a subject line that says in a very short form what was changed here.

@thefourtheye This approach looks good to you?

addaleax added the lib / src Issues and PRs related to general changes in the lib or src directory. label May 23, 2016

cjihrig commented May 23, 2016

Copy link
Copy Markdown
Contributor

@addaleax did you mean to close this?

cjihrig commented May 23, 2016

Copy link
Copy Markdown
Contributor

Sorry, confused this with the other PR with the same title.

mscdex added windows Issues and PRs related to the Windows platform. and removed lib / src Issues and PRs related to general changes in the lib or src directory. labels May 24, 2016

Copy link
Copy Markdown
Member

LGTM but the commit log should conform to the style guide and a regression test would be nice.

This bug is over four years old. It's amusing and a little odd it managed to go undiscovered for so long.

Kelmar commented May 24, 2016

Copy link
Copy Markdown
Author

@addaleax I'll get those changes in as soon as I am able; really I just ran across it and was like, "that seems like an easy fix." But yea, I'm glad to see there are regression tests. :)

Copy link
Copy Markdown
Member

@Kelmar yeah, don’t worry. Adding a regression test can also be done later and/or by someone else if you don’t find the time – again, if you need anything finding your way around here, just ask. :)

Kelmar commented May 24, 2016

Copy link
Copy Markdown
Author

@addaleax Done! I'll read over the contributing documentation now. I hope you find this fix helpful. :)

Comment thread test/parallel/test-cli-eval.js Outdated
// Missing argument should not crash
child.exec(nodejs + ' -e', function (status, stdout, stderr) {
assert.notStrictEqual(status, null);
assert.equal(status.code, 9);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

nit: It’s generally preferred to use assert.strictEqual over assert.equal

Kelmar commented May 24, 2016

Copy link
Copy Markdown
Author

Done!

Copy link
Copy Markdown
Member

LGTM up to assert.equal -> assert.strictEqual.

Thank you for the report + bugfix! Really funny this went unnoticed so long.

Fishrock123 changed the title Platform: Windows Fix windows segfault May 24, 2016
});

// Missing argument should not crash
child.exec(nodejs + ' -e', function(status, stdout, stderr) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

As the assertion happens within the callback, its better to use common.mustCall

Copy link
Copy Markdown
Contributor

LGTM + nits.

Copy link
Copy Markdown
Member

ping @Kelmar … There are only two things left to address here (commit log should conform to the style guide + Use strictEqual), that should be all and then this can be landed.

Kelmar commented Jun 6, 2016

Copy link
Copy Markdown
Author

@addaleax Okay, I believe this should fix everything up to your submission guide lines. Please let me know if I've missed anything or didn't interpret the instructions correctly. :)

addaleax commented Jun 6, 2016

Copy link
Copy Markdown
Member

@Kelmar There’s actually one point by @thefourtheye still open, namely that the callback for child.exec should be wrapped in common.mustCall(), like child.exec(…, common.mustCall(function(status, stdout, stderr) { … })) to make sure that the callback actually gets called.

I realize that the other tests in the file don’t set a good example here, but it would still be great if you could update your added test with that.

Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Member

Landed in 5bddc9a, fixed commit log and nit on landing.

@Kelmar Thanks for your contribution!

addaleax closed this Jun 20, 2016
addaleax pushed a commit that referenced this pull request Jun 20, 2016
When specifing a parameter that requries an additional argument on the
command line, node would segfault.  This appears to be specific to
Windows, adjusted command line argument parsing to hold a nullptr
terminal.

Adding unit test for crash on missing arguments.

PR-URL: #6938
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
evanlucas pushed a commit that referenced this pull request Jun 27, 2016
When specifing a parameter that requries an additional argument on the
command line, node would segfault.  This appears to be specific to
Windows, adjusted command line argument parsing to hold a nullptr
terminal.

Adding unit test for crash on missing arguments.

PR-URL: #6938
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Fishrock123 mentioned this pull request Jun 27, 2016
Fishrock123 mentioned this pull request Jul 5, 2016
MylesBorins pushed a commit that referenced this pull request Jul 11, 2016
When specifing a parameter that requries an additional argument on the
command line, node would segfault.  This appears to be specific to
Windows, adjusted command line argument parsing to hold a nullptr
terminal.

Adding unit test for crash on missing arguments.

PR-URL: #6938
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Jul 11, 2016
When specifing a parameter that requries an additional argument on the
command line, node would segfault.  This appears to be specific to
Windows, adjusted command line argument parsing to hold a nullptr
terminal.

Adding unit test for crash on missing arguments.

PR-URL: #6938
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
When specifing a parameter that requries an additional argument on the
command line, node would segfault.  This appears to be specific to
Windows, adjusted command line argument parsing to hold a nullptr
terminal.

Adding unit test for crash on missing arguments.

PR-URL: #6938
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
When specifing a parameter that requries an additional argument on the
command line, node would segfault.  This appears to be specific to
Windows, adjusted command line argument parsing to hold a nullptr
terminal.

Adding unit test for crash on missing arguments.

PR-URL: #6938
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins mentioned this pull request Jul 12, 2016
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
When specifing a parameter that requries an additional argument on the
command line, node would segfault.  This appears to be specific to
Windows, adjusted command line argument parsing to hold a nullptr
terminal.

Adding unit test for crash on missing arguments.

PR-URL: #6938
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
When specifing a parameter that requries an additional argument on the
command line, node would segfault.  This appears to be specific to
Windows, adjusted command line argument parsing to hold a nullptr
terminal.

Adding unit test for crash on missing arguments.

PR-URL: #6938
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. windows Issues and PRs related to the Windows platform.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL