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

Coverity fixes, round one by bnoordhuis · Pull Request #7374 · nodejs/node · GitHub

/ node Public

Coverity fixes, round one - #7374

Merged
bnoordhuis merged 10 commits into
nodejs:masterfrom
bnoordhuis:coverity-fixes-round-one
Jun 29, 2016
Merged

Coverity fixes, round one#7374
bnoordhuis merged 10 commits into
nodejs:masterfrom
bnoordhuis:coverity-fixes-round-one

Conversation

bnoordhuis commented Jun 22, 2016
edited
Loading

Copy link
Copy Markdown
Member

Issues pointed out by Coverity.

CI: https://ci.nodejs.org/job/node-test-pull-request/3056/

bnoordhuis added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Jun 22, 2016

Copy link
Copy Markdown
Member

LGTM, CI failure seems to be infrastructure-related

Copy link
Copy Markdown
Member

LGTM

1 similar comment

cjihrig commented Jun 23, 2016

Copy link
Copy Markdown
Contributor

LGTM

Comment thread src/fs_event_wrap.cc Outdated

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

just wondering, could these have been initialized in the initializer list of FSEventWrap::FSEventWrap?

Copy link
Copy Markdown
Member Author

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

Could have, yes, but I think the C++11 way of assigning at definition is clearer; no need to look up the constructor to see if and how it's assigned.

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

Understood. Thanks

jasnell commented Jun 27, 2016

Copy link
Copy Markdown
Member

LGTM

bnoordhuis force-pushed the coverity-fixes-round-one branch from 5ebe1ba to 23d31b4 Compare June 29, 2016 09:09

Copy link
Copy Markdown
Member Author

Rebased with no structural changes. New CI: https://ci.nodejs.org/job/node-test-pull-request/3117/

Pointed out by Coverity.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Pointed out by Coverity.  Not really a bug because it's assigned before
use but explicit assignment in the constructor is more obviously
correct.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit adds a CHECK that verifies that the file event watcher is
not started twice, which would be indicative of a bug in lib/fs.js.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Remove TLSWrap::write_queue_size_, it's not used anywhere.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
The code assigned the result of EVP_get_digestbyname() to data members
called md_ that were not used outside the initialization functions.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Pointed out by Coverity.  Introduced in commit 5b8e1da from September
2011 ("Initial pass at zlib bindings".)

The asynchronous version of Write() used a pointer to a stack-allocated
buffer on flush.  A mitigating factor is that zlib does not dereference
the pointer for zero-sized writes but it's still technically UB.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Pointed out by Coverity.  Introduced in commit 05d30d5 from July 2015
("fs: implemented WriteStream#writev").

WriteBuffers() leaked memory in the synchronous uv_fs_write() error path
when trying to write > 1024 buffers.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Pointed out by Coverity.  Introduced in commits 3546383 ("process_wrap:
avoid leaking memory when throwing due to invalid arguments") and
fa4eb47 ("bindings: add spawn_sync bindings").

The return statements inside the if blocks were dead code because their
guard conditions always evaluated to false.  Remove them.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
bnoordhuis force-pushed the coverity-fixes-round-one branch from 23d31b4 to ed3d8b1 Compare June 29, 2016 10:23
bnoordhuis closed this Jun 29, 2016
bnoordhuis deleted the coverity-fixes-round-one branch June 29, 2016 10:23
bnoordhuis merged commit ed3d8b1 into nodejs:master Jun 29, 2016
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
Pointed out by Coverity.

PR-URL: #7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
Pointed out by Coverity.  Not really a bug because it's assigned before
use but explicit assignment in the constructor is more obviously
correct.

PR-URL: #7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
This commit adds a CHECK that verifies that the file event watcher is
not started twice, which would be indicative of a bug in lib/fs.js.

PR-URL: #7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
Remove TLSWrap::write_queue_size_, it's not used anywhere.

PR-URL: #7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
The code assigned the result of EVP_get_digestbyname() to data members
called md_ that were not used outside the initialization functions.

PR-URL: #7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
PR-URL: #7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
PR-URL: #7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
Pointed out by Coverity.  Introduced in commit 5b8e1da from September
2011 ("Initial pass at zlib bindings".)

The asynchronous version of Write() used a pointer to a stack-allocated
buffer on flush.  A mitigating factor is that zlib does not dereference
the pointer for zero-sized writes but it's still technically UB.

PR-URL: #7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
Pointed out by Coverity.  Introduced in commit 05d30d5 from July 2015
("fs: implemented WriteStream#writev").

WriteBuffers() leaked memory in the synchronous uv_fs_write() error path
when trying to write > 1024 buffers.

PR-URL: #7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
Pointed out by Coverity.  Introduced in commits 3546383 ("process_wrap:
avoid leaking memory when throwing due to invalid arguments") and
fa4eb47 ("bindings: add spawn_sync bindings").

The return statements inside the if blocks were dead code because their
guard conditions always evaluated to false.  Remove them.

PR-URL: #7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fishrock123 mentioned this pull request Jul 5, 2016

Copy link
Copy Markdown
Contributor

@bnoordhuis this is not landing cleanly on v4.x would you be able to backport?

bnoordhuis added a commit to bnoordhuis/io.js that referenced this pull request Jul 11, 2016
Pointed out by Coverity.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
bnoordhuis added a commit to bnoordhuis/io.js that referenced this pull request Jul 11, 2016
This commit adds a CHECK that verifies that the file event watcher is
not started twice, which would be indicative of a bug in lib/fs.js.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
bnoordhuis added a commit to bnoordhuis/io.js that referenced this pull request Jul 11, 2016
Remove TLSWrap::write_queue_size_, it's not used anywhere.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
bnoordhuis added a commit to bnoordhuis/io.js that referenced this pull request Jul 11, 2016
The code assigned the result of EVP_get_digestbyname() to data members
called md_ that were not used outside the initialization functions.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
bnoordhuis added a commit to bnoordhuis/io.js that referenced this pull request Jul 11, 2016
PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
bnoordhuis added a commit to bnoordhuis/io.js that referenced this pull request Jul 11, 2016
PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
bnoordhuis added a commit to bnoordhuis/io.js that referenced this pull request Jul 11, 2016
Pointed out by Coverity.  Introduced in commit 5b8e1da from September
2011 ("Initial pass at zlib bindings".)

The asynchronous version of Write() used a pointer to a stack-allocated
buffer on flush.  A mitigating factor is that zlib does not dereference
the pointer for zero-sized writes but it's still technically UB.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
bnoordhuis added a commit to bnoordhuis/io.js that referenced this pull request Jul 11, 2016
Pointed out by Coverity.  Introduced in commits 3546383 ("process_wrap:
avoid leaking memory when throwing due to invalid arguments") and
fa4eb47 ("bindings: add spawn_sync bindings").

The return statements inside the if blocks were dead code because their
guard conditions always evaluated to false.  Remove them.

PR-URL: nodejs#7374
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
MylesBorins mentioned this pull request Jul 12, 2016
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++. lib / src Issues 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.

7 participants


Back | FazBrowse Home | New Git URL