-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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: throws error if position argument is bigint in fs.readSync & fs.read #36198
Conversation
hmm... while the changes in this look good, I'm actually wondering if we shouldn't go the other way and actually allow bigints in these apis. |
As @BridgeAR mentioned here, isn't it better to let the user handle it on their own? |
@@ -543,6 +543,9 @@ function read(fd, buffer, offset, length, position, callback) { | |||
|
|||
validateOffsetLengthRead(offset, length, buffer.byteLength); | |||
|
|||
if (typeof position === 'bigint') |
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.
This seems to be a check that can be performed early instead of being this late? Before validateBuffer
would be a good place I think.
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.
Wouldn't it be better to have arguments validation in order?
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.
My concern was mostly about the if (length === 0)
above which means if the length is 0 you'd be able to get away with these checks..but thinking again it was already the case for a few other cases above, so it's probably not a bit deal.
I think this can be closed in favour of #36190 |
Fixes #36185
make -j4 test
(UNIX), orvcbuild test
(Windows) passes