-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #56942 +/- ##
==========================================
- Coverage 89.17% 89.15% -0.03%
==========================================
Files 665 665
Lines 192554 192853 +299
Branches 37064 37151 +87
==========================================
+ Hits 171710 171929 +219
- Misses 13645 13695 +50
- Partials 7199 7229 +30
|
037065d
to
3b4e551
Compare
@Aditi-1400 Can you wrap the commit message by 72 characters? https://github.com/nodejs/node/actions/runs/13198267230/job/36844336252?pr=56942 |
3b4e551
to
8c80bb8
Compare
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.
8c80bb8
to
ba86f84
Compare
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.