Automattic / Automattic/node-canvas

PVS-Studio: Not all members of a class are initialized inside the constructor.

Open
#904 0 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

We have found bugs using PVS-Studio tool. PVS-Studio is a static code analyzer for C, C++ and C#: https://www.viva64.com/en/pvs-studio/

We suggests having a look at the emails, sent from @pvs-studio.com.

[V730](https://www.viva64.com/en/w/V730/) Not all members of a class are initialized inside the constructor. Consider inspecting: **data_mode**. image.cc 315

```
....
enum data_mode_t {
DATA_IMAGE = 1
, DATA_MIME = 2
} data_mode;
....

Image::Image() {
filename = NULL;
_data = NULL;
_data_len = 0;
_surface = NULL;
width = height = 0;
state = DEFAULT;
onload = NULL;
onerror = NULL;
}
```
There are many such fragments in the code, here are some of them:

- V730 Not all members of a class are initialized inside the constructor. Consider inspecting: _path. canvasrenderingcontext2d.cc 150
- V730 Not all members of a class are initialized inside the constructor. Consider inspecting: isolate_, prev_next_, prev_limit_. v8.h 908
- V730 Not all members of a class are initialized inside the constructor. Consider inspecting: str_st_. nan.h 907

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the PVS-Studio V730 report in image.cc at line 315, then inspect the related reports in canvasrenderingcontext2d.cc, v8.h, and nan.h. Review the affected constructors and determine the complete set of reported uninitialized members; done means the identified V730 findings are addressed and the relevant checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.