fs: coerce FileHandle.read length like fs.read · nodejs/node@a27db42 · GitHub
Skip to content

Commit a27db42

Browse files
xia-chaoaduh95
authored andcommitted
fs: coerce FileHandle.read length like fs.read
Non-number length values reached node::fs::Read, which CHECKs IsInt32() and aborts the process. Apply length |= 0 after defaulting, matching fs.read and fs.readSync. Signed-off-by: Xia Chao <236466140+bun-unsafe@users.noreply.github.com> PR-URL: #65521 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name>
1 parent 1260642 commit a27db42

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

‎lib/internal/fs/promises.js‎

Lines changed: 1 addition & 0 deletions

‎test/parallel/test-fs-promises-file-handle-read.js‎

Lines changed: 22 additions & 0 deletions

0 commit comments

Comments
 (0)