Skip to content

src: fix --abort_on_uncaught_exception arg parsing - #13004

Merged
sam-github merged 1 commit into
nodejs:masterfrom
sam-github:fix-abort-on-uncaught-exception
May 16, 2017
Merged

src: fix --abort_on_uncaught_exception arg parsing#13004
sam-github merged 1 commit into
nodejs:masterfrom
sam-github:fix-abort-on-uncaught-exception

Conversation

@sam-github

Copy link
Copy Markdown
Contributor

Fix c0bde73, which inadvertently introduced a use of strcmp() without
correctly comparing its return to zero. Caught by coverity:

 >>> CID 169223: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
>>> The "or" condition "strcmp(arg, "--abort-on-uncaught-exception") || strcmp(arg, "--abort_on_uncaught_exception")" will always be true because "arg" cannot be equal to two different values at the same time, so it must be not equal to at least one of them.
3909 } else if (strcmp(arg, "--abort-on-uncaught-exception") ||
3910 strcmp(arg, "--abort_on_uncaught_exception")) {
3911 abort_on_uncaught_exception = true;
3912 // Also a V8 option. Pass through as-is.
3913 new_v8_argv[new_v8_argc] = arg;
3914 new_v8_argc += 1;

See: https://github.com/nodejs/node/pull/12892/files#r116055631

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

src

@nodejs-github-botnodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label May 12, 2017
@addaleaxaddaleax added dont-land-on-v4.x lib / src Issues and PRs related to general changes in the lib or src directory. labels May 12, 2017
@sam-github

Copy link
Copy Markdown
ContributorAuthor

Fix c0bde73, which inadvertently introduced a use of strcmp() without
correctly comparing its return to zero. Caught by coverity:
>>> CID 169223: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
>>> The "or" condition "strcmp(arg, "--abort-on-uncaught-exception") || strcmp(arg, "--abort_on_uncaught_exception")" will always be true because "arg" cannot be equal to two different values at the same time, so it must be not equal to at least one of them.
3909 } else if (strcmp(arg, "--abort-on-uncaught-exception") ||
3910 strcmp(arg, "--abort_on_uncaught_exception")) {
3911 abort_on_uncaught_exception = true;
3912 // Also a V8 option. Pass through as-is.
3913 new_v8_argv[new_v8_argc] = arg;
3914 new_v8_argc += 1;
PR-URL: nodejs#13004
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@sam-github
sam-githubforce-pushed the fix-abort-on-uncaught-exception branch from 04a7057 to 53dae83CompareMay 16, 2017 21:04
@sam-github
sam-github merged commit 53dae83 into nodejs:masterMay 16, 2017
@sam-github
sam-github deleted the fix-abort-on-uncaught-exception branch May 16, 2017 21:07
anchnk pushed a commit to anchnk/node that referenced this pull request May 19, 2017
Fix c0bde73, which inadvertently introduced a use of strcmp() without
correctly comparing its return to zero. Caught by coverity:
>>> CID 169223: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
>>> The "or" condition "strcmp(arg, "--abort-on-uncaught-exception") || strcmp(arg, "--abort_on_uncaught_exception")" will always be true because "arg" cannot be equal to two different values at the same time, so it must be not equal to at least one of them.
3909 } else if (strcmp(arg, "--abort-on-uncaught-exception") ||
3910 strcmp(arg, "--abort_on_uncaught_exception")) {
3911 abort_on_uncaught_exception = true;
3912 // Also a V8 option. Pass through as-is.
3913 new_v8_argv[new_v8_argc] = arg;
3914 new_v8_argc += 1;
PR-URL: nodejs#13004
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@jasnelljasnell mentioned this pull request May 28, 2017
Sign up for freeto 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++.lib / srcIssues and PRs related to general changes in the lib or src directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@sam-github@jasnell@addaleax@lpinca@cjihrig@richardlau@gibfahn@nodejs-github-bot