fs: validate mode as Int32 in ReadStream/WriteStream constructors by wdskuki · Pull Request #62538 · nodejs/node
Fixes a regression where passing a mode value that exceeds Int32 max (but is within UInt32 range) to createWriteStream or createReadStream would cause an assertion failure crash instead of throwing a catchable RangeError. The issue was introduced when mode validation was moved from JS to C++, but the ReadStream/WriteStream constructors were not updated to validate the mode option before passing it to the C++ layer. Changes: - Import and use parseFileMode in lib/internal/fs/streams.js for both ReadStream and WriteStream constructors - Change parseFileMode in lib/internal/validators.js to use validateInt32 instead of validateUint32 to match C++ expectations - Add regression test for issue nodejs#62516 Fixes: nodejs#62516 PR-URL: TBD Reviewed-By: TBD