You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Abort/core dump in fs.closeSync upon fd of greater than 32 bit #28980
c++Issues and PRs that require attention from people who are familiar with C++.confirmed-bugIssues and PRs for confirmed bugs.fsIssues and PRs related to file-system APIs and the fs module.
Thrown:
RangeError [ERR_OUT_OF_RANGE]: The value of "fd" is out of range. It must be >= 0 && < 4294967296. Received 4294967296
at Object.closeSync (fs.js:405:3)
at repl:1:4
at Script.runInThisContext (vm.js:126:20)
at REPLServer.defaultEval (repl.js:384:29)
at bound (domain.js:415:14)
at REPLServer.runBound [as eval] (domain.js:428:12)
at REPLServer.onLine (repl.js:700:10)
at REPLServer.emit (events.js:208:15)
at REPLServer.EventEmitter.emit (domain.js:471:20)
at REPLServer.Interface._onLine (readline.js:316:10)
Close() in src/node_file.cc checks that it's an int32 whereas the binding.close() wrappers in lib/fs.js (close() and closeSync()) check that it's an uint32.
I think the logic in that last file should be updated to only accept integers in the range 0..2**31-1, i.e.:
c++Issues and PRs that require attention from people who are familiar with C++.confirmed-bugIssues and PRs for confirmed bugs.fsIssues and PRs related to file-system APIs and the fs module.
Activity
bnoordhuis commentedon Aug 6, 2019
Can confirm. Added labels.
Close()in src/node_file.cc checks that it's an int32 whereas thebinding.close()wrappers in lib/fs.js (close()andcloseSync()) check that it's an uint32.I think the logic in that last file should be updated to only accept integers in the range
0..2**31-1, i.e.:edit: missed Colin's PR somehow...
fs: validate fds as int32s
fs: validate fds as int32s