Skip to content
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

src: address coverity warning in node_file.cc #45565

Closed
wants to merge 1 commit into from

Conversation

mhdawson
Copy link
Member

Address coverity warning that looks like
it identifies a potential crash due to using
a value after it's been passed into std::move

Signed-off-by: Michael Dawson [email protected]

Address coverity warning that looks like
it identifies a potential crash due to using
a value after it's been passed into std::move

Signed-off-by: Michael Dawson <[email protected]>
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Nov 21, 2022
@mhdawson
Copy link
Member Author

This is the coverity warning and it looks like a real problem to me

1584          std::string dirname = path.substr(0,
1585                                            path.find_last_of(kPathSeparator));
    	3. Condition dirname != path, taking true branch.
1586          if (dirname != path) {
    	4. move: path is moved (indicated by std::move(path)).
1587            req_wrap->continuation_data()->PushPath(std::move(path));
1588            req_wrap->continuation_data()->PushPath(std::move(dirname));
    	5. Falling through to end of if statement.
1589          } else if (req_wrap->continuation_data()->paths().size() == 0) {
1590            err = UV_EEXIST;
1591            continue;
1592          }
1593          uv_fs_req_cleanup(req);
    	
CID 276285 (#1 of 1): Using a moved object (USE_AFTER_MOVE)
6. use_after_move: path is used after it has been already moved.
1594          MKDirpAsync(loop, req, path.c_str(),
1595                      req_wrap->continuation_data()->mode(), nullptr);
1596          break;
1597        }

@daeyeon daeyeon added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Nov 22, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 22, 2022
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

mhdawson added a commit that referenced this pull request Nov 24, 2022
Address coverity warning that looks like
it identifies a potential crash due to using
a value after it's been passed into std::move

Signed-off-by: Michael Dawson <[email protected]>

PR-URL: #45565
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Daeyeon Jeong <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
@mhdawson
Copy link
Member Author

Landed in a01dbf1

@mhdawson mhdawson closed this Nov 24, 2022
ruyadorno pushed a commit that referenced this pull request Nov 24, 2022
Address coverity warning that looks like
it identifies a potential crash due to using
a value after it's been passed into std::move

Signed-off-by: Michael Dawson <[email protected]>

PR-URL: #45565
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Daeyeon Jeong <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
@ruyadorno ruyadorno mentioned this pull request Nov 24, 2022
ErickWendel pushed a commit to ErickWendel/node that referenced this pull request Nov 30, 2022
Address coverity warning that looks like
it identifies a potential crash due to using
a value after it's been passed into std::move

Signed-off-by: Michael Dawson <[email protected]>

PR-URL: nodejs#45565
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Daeyeon Jeong <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
Address coverity warning that looks like
it identifies a potential crash due to using
a value after it's been passed into std::move

Signed-off-by: Michael Dawson <[email protected]>

PR-URL: #45565
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Daeyeon Jeong <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
Address coverity warning that looks like
it identifies a potential crash due to using
a value after it's been passed into std::move

Signed-off-by: Michael Dawson <[email protected]>

PR-URL: #45565
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Daeyeon Jeong <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
Address coverity warning that looks like
it identifies a potential crash due to using
a value after it's been passed into std::move

Signed-off-by: Michael Dawson <[email protected]>

PR-URL: #45565
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Daeyeon Jeong <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 4, 2023
Address coverity warning that looks like
it identifies a potential crash due to using
a value after it's been passed into std::move

Signed-off-by: Michael Dawson <[email protected]>

PR-URL: #45565
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Daeyeon Jeong <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 5, 2023
Address coverity warning that looks like
it identifies a potential crash due to using
a value after it's been passed into std::move

Signed-off-by: Michael Dawson <[email protected]>

PR-URL: #45565
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Daeyeon Jeong <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants