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

wasm: add missing init reported by coverity by mhdawson · Pull Request #42897 · nodejs/node · GitHub

/ node Public

wasm: add missing init reported by coverity - #42897

Closed
mhdawson wants to merge 1 commit into
nodejs:masterfrom
mhdawson:coverity-21
Closed

wasm: add missing init reported by coverity#42897
mhdawson wants to merge 1 commit into
nodejs:masterfrom
mhdawson:coverity-21

Conversation

Copy link
Copy Markdown
Member

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

Signed-off-by: Michael Dawson <mdawson@devrus.com>
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. labels Apr 28, 2022

Copy link
Copy Markdown
Member Author

Report from coverity:

26 private:
27  WasmStreamingObject(Environment* env, v8::Local<v8::Object> object)
28      : BaseObject(env, object) {
29    MakeWeak();
  	
CID 254660 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
2. uninit_member: Non-static class member wasm_size_ is not initialized in this constructor nor in any functions that it calls.
30  }
31
32  ~WasmStreamingObject() override {}
33
34 private:
35  static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
36  static void SetURL(const v8::FunctionCallbackInfo<v8::Value>& args);
37  static void Push(const v8::FunctionCallbackInfo<v8::Value>& args);
38  static void Finish(const v8::FunctionCallbackInfo<v8::Value>& args);
39  static void Abort(const v8::FunctionCallbackInfo<v8::Value>& args);
40
41  std::shared_ptr<v8::WasmStreaming> streaming_;
  	1. member_decl: Class member declaration for wasm_size_.
42  size_t wasm_size_;
43};

Copy link
Copy Markdown
Member

FWIW, this is where the initialization currently happens:

Local<Function> ctor = Initialize(env);
Local<Object> obj;
if (!ctor->NewInstance(env->context(), 0, nullptr).ToLocal(&obj)) {
return MaybeLocal<Object>();
}
CHECK(streaming);
WasmStreamingObject* ptr = Unwrap<WasmStreamingObject>(obj);
CHECK_NOT_NULL(ptr);
ptr->streaming_ = streaming;
ptr->wasm_size_ = 0;
return obj;

Other functions rely on the assumption that the initialization ran (e.g., will abort the process if streaming_ has not been initialized to a non-nullptr value).

Eventually, we might want to revisit how we initialize C++ backed JS objects in general.

mhdawson added the request-ci Add this label to start a Jenkins CI on a PR. label May 2, 2022
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 2, 2022

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

mhdawson added a commit that referenced this pull request May 10, 2022
Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: #42897
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>

Copy link
Copy Markdown
Member Author

Landed in 7649989

mhdawson closed this May 10, 2022
BethGriggs pushed a commit that referenced this pull request May 16, 2022
Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: #42897
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
RafaelGSS mentioned this pull request May 16, 2022

Copy link
Copy Markdown
Member

Backport refs: #42701

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++. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL