-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
fs: fix file descriptor validator #49752
Conversation
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.
One additional step you could take is this (pseudo-ish code):
if (isFd(fd)) validateInteger(fd, 'options.fd', 0, kMaxInt32);
While passing ex. -1 or -42 to libuv is Mostly Harmless (should fail with UV_EBADF) it's probably best to turn what is currently a runtime error into a validation error. That might make it semver-major though.
(And I vote to rename kMaxInt
to kMaxUint32
because I find the former highly misleading.)
@bnoordhuis I'll follow up with a different pull request |
394e7e0
to
fa56769
Compare
@lpinca @bnoordhuis I had to force-push to rebase. Can you re-review? |
Landed in 5d6aa85 |
PR-URL: #49752 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#49752 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Ref #49691 (comment) by @bnoordhuis