Skip to content

node-api: address coverity warning - #45563

Closed
mhdawson wants to merge 1 commit into
nodejs:mainfrom
mhdawson:coverity-25
Closed

mhdawson wants to merge 1 commit into
nodejs:mainfrom
mhdawson:coverity-25

Conversation

@mhdawson

Copy link
Copy Markdown
Member
  • address coverity unitialized variable warning

Signed-off-by: Michael Dawson mdawson@devrus.com

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/node-api

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. node-api Issues and PRs related to Node-API. labels Nov 21, 2022
@mhdawson

mhdawson commented Nov 21, 2022 •

Copy link
Copy Markdown
Member Author

This is the report. I think technically it may be a false positive, but initializing the variable seems ok as well, so PR does that versus marking as false positive.

/ Create a new napi_env for this specific module.
634  napi_env env = v8impl::NewEnv(context, module_filename);
635
   	3. var_decl: Declaring variable _exports without initializer.
636  napi_value _exports;
637  env->CallIntoModule([&](napi_env env) {
638    _exports = init(env, v8impl::JsValueFromV8LocalValue(exports));
639  });
640
641  // If register function returned a non-null exports object different from
642  // the exports object we passed it, set that as the "exports" property of
643  // the module.
   	
CID 276441 (#1 of 1): Uninitialized pointer read (UNINIT)
4. uninit_use: Using uninitialized value _exports.
644  if (_exports != nullptr &&
645      _exports != v8impl::JsValueFromV8LocalValue(exports)) {
646    napi_value _module = v8impl::JsValueFromV8LocalValue(module);
647    napi_set_named_property(env, _module, "exports", _exports);
648  }

- address coverity unitialized variable warning

Signed-off-by: Michael Dawson <mdawson@devrus.com>
@daeyeon daeyeon added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Nov 22, 2022
@Trott Trott changed the title doc: address coverity warning node-api: address coverity warning Nov 22, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 22, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

mhdawson added a commit that referenced this pull request Nov 24, 2022
- address coverity unitialized variable warning

Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: #45563
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@mhdawson

Copy link
Copy Markdown
Member Author

Landed in 0bbef56

@mhdawson mhdawson closed this Nov 24, 2022
ruyadorno pushed a commit that referenced this pull request Nov 24, 2022
- address coverity unitialized variable warning

Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: #45563
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@ruyadorno ruyadorno mentioned this pull request Nov 24, 2022
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
- address coverity unitialized variable warning

Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: #45563
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
- address coverity unitialized variable warning

Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: #45563
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
danielleadams pushed a commit that referenced this pull request Jan 5, 2023
- address coverity unitialized variable warning

Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: #45563
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Assignees

Couldn't load assignees.