-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Fix windows segfault #6938
Fix windows segfault #6938
Conversation
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.
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:
@thefourtheye This approach looks good to you? |
@addaleax did you mean to close this? |
Sorry, confused this with the other PR with the same title. |
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. |
@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. :) |
@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. :) |
@addaleax Done! I'll read over the contributing documentation now. I hope you find this fix helpful. :) |
// Missing argument should not crash | ||
child.exec(nodejs + ' -e', function (status, stdout, stderr) { | ||
assert.notStrictEqual(status, null); | ||
assert.equal(status.code, 9); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It’s generally preferred to use assert.strictEqual
over assert.equal
Done! |
LGTM up to Thank you for the report + bugfix! Really funny this went unnoticed so long. |
@@ -66,6 +66,12 @@ child.exec(nodejs + ' --eval "require(\'./test/parallel/test-cli-eval.js\')"', | |||
assert.equal(status.code, 42); | |||
}); | |||
|
|||
// Missing argument should not crash | |||
child.exec(nodejs + ' -e', function(status, stdout, stderr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the assertion happens within the callback, its better to use common.mustCall
LGTM + nits. |
ping @Kelmar … There are only two things left to address here ( |
@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. :) |
@Kelmar There’s actually one point by @thefourtheye still open, namely that the callback for 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. |
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>
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>
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>
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>
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>
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>
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>
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>
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