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 <[email protected]>
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 <[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