-
-
Notifications
You must be signed in to change notification settings - Fork 34.8k
Closed
Closed
Copy link
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.
Description
- Version: v10.15.0
- Platform: Win64, Linux (all)
- Subsystem: fs
const fs = require("fs");
const dest = new Uint16Array(1073741824);
// dest.byteLength > buffer.kMaxLength
const fd = fs.openSync("./temp.dat", "r");
fs.readSync(fd, dest, 0, dest.byteLength, 0);throws
RangeError [ERR_OUT_OF_RANGE]: The value of "length" is out of range. It must be >= 0 && <= 2147483648. Received -2147483648
That's because length |= 0 here converts to signed int32.
Since the max TypedArray size in v8 is expanding to MAX_SAFE_INTEGER, switching to Math.round() I think makes sense (vs adding >>> 0, which would only support uint32)? Happy to open a PR if agreed.
(#21994 looks slightly related, but is about bigint position values.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.