-
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 validation of negative offset to avoid abort #38421
fs: fix validation of negative offset to avoid abort #38421
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I think that the real issue is only in write as negative offset is already checked in Note that the check for fs.open('./tst/some-file.file', 'w+', (err, fd) => {
fs.write(fd, Buffer.from('text'), 0, -10, (err) => {
console.log(err);
});
}) |
Yeah, I modified the reads here just for consistency.
Sigh. Yeah, missed that. |
Fixes: nodejs#24640 Signed-off-by: James M Snell <[email protected]>
bce3d67
to
837137f
Compare
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.
Would it make sense to also move validateInteger(offset, 'offset', 0);
into validateOffsetLengthRead
and validateOffsetLengthWrite
? That way, we could have just one validation for each field.
Co-authored-by: linkgoron <[email protected]>
Perhaps, but let's save that for a separate PR. |
Landed in 4af15df |
Fixes: #24640 Signed-off-by: James M Snell <[email protected]> PR-URL: #38421 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Nitzan Uziely <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Fixes: #24640 Signed-off-by: James M Snell <[email protected]> PR-URL: #38421 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Nitzan Uziely <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Fixes: #24640 Signed-off-by: James M Snell <[email protected]> PR-URL: #38421 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Nitzan Uziely <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Fixes: #24640 Signed-off-by: James M Snell <[email protected]> PR-URL: #38421 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Nitzan Uziely <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Fixes: #24640 Signed-off-by: James M Snell <[email protected]> PR-URL: #38421 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Nitzan Uziely <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Fixes: #24640 Signed-off-by: James M Snell <[email protected]> PR-URL: #38421 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Nitzan Uziely <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Signed-off-by: James M Snell [email protected]
Fixes: #24640