Skip to content

src: fix possible dereference of NULL pointer #58459

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Eusgor
Copy link

@Eusgor Eusgor commented May 26, 2025

There is a CHECK_NOT_NULL check before dereferencing node_env on line 710 in the if block, but there is no CHECK_NOT_NULL check before dereferencing node_env on line 721. Maybe it makes sense to put CHECK_NOT_NULL right after calling the Environment::GetCurrent function?

Copy link

codecov bot commented May 26, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.19%. Comparing base (19e0d47) to head (8c14942).
Report is 27 commits behind head on main.

Files with missing lines Patch % Lines
src/node_api.cc 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58459      +/-   ##
==========================================
- Coverage   90.21%   90.19%   -0.02%     
==========================================
  Files         635      635              
  Lines      187304   187344      +40     
  Branches    36782    36788       +6     
==========================================
+ Hits       168970   168984      +14     
- Misses      11093    11140      +47     
+ Partials     7241     7220      -21     
Files with missing lines Coverage Δ
src/node_api.cc 76.16% <0.00%> (ø)

... and 49 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@legendecas
Copy link
Member

Would you mind updating the commit message following https://github.com/nodejs/node/blob/main/doc/contributing/pull-requests.md#commit-message-guidelines? Thank you!

@Eusgor Eusgor changed the title Fix possible dereference of NULL pointer src: fix possible dereference of NULL pointer May 27, 2025
There is a CHECK_NOT_NULL check before dereferencing node_env on
line 710 in the "if" block, but there is no CHECK_NOT_NULL check before
dereferencing node_env on line 721. Maybe it makes sense to put
CHECK_NOT_NULL right after calling the Environment::GetCurrent function.
@Eusgor Eusgor force-pushed the fix-possible-dereference-of-null branch from 6025590 to 8c14942 Compare May 27, 2025 07:14
@Eusgor
Copy link
Author

Eusgor commented May 27, 2025

Is everything right now?

@addaleax addaleax added request-ci Add this label to start a Jenkins CI on a PR. node-api Issues and PRs related to the Node-API. labels May 28, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 28, 2025
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node-api Issues and PRs related to the Node-API.
Projects
Status: Need Triage
Development

Successfully merging this pull request may close these issues.

5 participants