fs: fix validation of negative offset to avoid abort#38421
fs: fix validation of negative offset to avoid abort#38421jasnell wants to merge 2 commits intonodejs:masterfrom
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 <jasnell@gmail.com>
bce3d67 to
837137f
Compare
RaisinTen
left a comment
There was a problem hiding this comment.
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 <Linkgoron@users.noreply.github.com>
Perhaps, but let's save that for a separate PR. |
|
Landed in 4af15df |
Signed-off-by: James M Snell jasnell@gmail.com
Fixes: #24640