Closed
Description
- Version:
v12.7.0
installed with nvm - Platform:
Linux lt2.cfware.com 5.1.20-300.fc30.x86_64 #1 SMP Fri Jul 26 15:03:11 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem:
fs
Tested in REPL:
const fs = require('fs')
fs.closeSync(4294967296)
fs.closeSync(4294967295)
fs.closeSync(4294967296)
produces a JS exception:
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)
fs.closeSync(4294967295)
trips a C++ assertion:
node[28006]: ../src/node_file.cc:802:void node::fs::Close(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `args[0]->IsInt32()' failed.
1: 0x9afed0 node::Abort() [node]
2: 0x9aff57 [node]
3: 0x9ba25a node::fs::Close(v8::FunctionCallbackInfo<v8::Value> const&) [node]
4: 0xb90726 [node]
5: 0xb92647 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
6: 0x1318979 [node]
Aborted (core dumped)
Obviously this is not a reasonable thing to do but an invalid fd it should produce a JS exception and not core dump.