Skip to content

Add missing null checks for njs_promise_create_function allocations #912

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

Merged
merged 1 commit into from
May 15, 2025

Conversation

Nekrolm
Copy link
Contributor

@Nekrolm Nekrolm commented May 15, 2025

Proposed changes

Hi!
I'm experimenting with memory pool limits for NJS and I've spotted 2 places where the result of
njs_promise_create_function call is dereferenced without proper checks. Causing segmentation fault on nullptr dereference.

I'm not able to share minimal example -- it's hard to hit precisely these two lines via memory allocation failure.

Checklist

Before creating a PR, run through this checklist and mark each as complete:

  • I have read the CONTRIBUTING document
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes

Copy link
Contributor

@xeioex xeioex left a comment

Choose a reason for hiding this comment

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

Hi @Nekrolm,

Thank you for contribution. The change looks good with minor changes needed.

Please, follow contribution guide in regards to commit log messages.

Suggested commit message: Added missing null checks in promise code.

Please, also, squash all the changes into a single commit. No merge commits.

@Nekrolm Nekrolm force-pushed the master branch 4 times, most recently from 385bc47 to fa3a1bf Compare May 15, 2025 16:40
@Nekrolm Nekrolm requested a review from xeioex May 15, 2025 16:40
@xeioex xeioex merged commit 04721dd into nginx:master May 15, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy