-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
module: prevent crashes in require.resolve() when path is not a string #56942
Open
Aditi-1400
wants to merge
1
commit into
nodejs:main
Choose a base branch
from
Aditi-1400:issue-47698
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+25
−0
Conversation
This file contains 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
Review requested:
|
nodejs-github-bot
added
module
Issues and PRs related to the module subsystem.
needs-ci
PRs that need a full CI run.
labels
Feb 6, 2025
joyeecheung
approved these changes
Feb 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
github-actions
bot
removed
the
request-ci
Add this label to start a Jenkins CI on a PR.
label
Feb 6, 2025
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
jasnell
reviewed
Feb 7, 2025
jasnell
approved these changes
Feb 7, 2025
Aditi-1400
force-pushed
the
issue-47698
branch
from
February 7, 2025 10:46
037065d
to
3b4e551
Compare
github-actions
bot
removed
the
request-ci
Add this label to start a Jenkins CI on a PR.
label
Feb 7, 2025
This comment was marked as outdated.
This comment was marked as outdated.
aduh95
approved these changes
Feb 7, 2025
aduh95
added
the
author ready
PRs that have at least one approval, no pending requests for changes, and a CI started.
label
Feb 7, 2025
lpinca
approved these changes
Feb 7, 2025
jsumners-nr
approved these changes
Feb 7, 2025
@Aditi-1400 Can you wrap the commit message by 72 characters? https://github.com/nodejs/node/actions/runs/13198267230/job/36844336252?pr=56942 |
Aditi-1400
force-pushed
the
issue-47698
branch
from
February 7, 2025 19:45
3b4e551
to
8c80bb8
Compare
This was referenced Feb 7, 2025
Previously, `require.resolve()` could crash when: - The first parameter was a relative path and - The `paths` array contained non-string entries This commit fixes the issue by adding a check in `Module._findPath` to ensure all elements in `paths` are strings, and adding a validation in `stat` before calling `InternalModuleStat` to guard against non-string filenames.
Aditi-1400
force-pushed
the
issue-47698
branch
from
February 7, 2025 21:19
8c80bb8
to
ba86f84
Compare
github-actions
bot
removed
the
request-ci
Add this label to start a Jenkins CI on a PR.
label
Feb 10, 2025
This comment was marked as outdated.
This comment was marked as outdated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
author ready
PRs that have at least one approval, no pending requests for changes, and a CI started.
module
Issues and PRs related to the module subsystem.
needs-ci
PRs that need a full CI run.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #47698
Previously,
require.resolve()
would crash when:paths
array contained non-string entriesThis commit fixes the issue by adding a check in
Module._findPath
to ensure all elements inpaths
are strings, and adding a validation instat
before callingInternalModuleStat
to guard against non-string filenames.