Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fs: throws error if position argument is bigint
Fixes: #36190
  • Loading branch information
darvesh committed Nov 20, 2020
commit 41b099986da5a6d40c981c31e89fbc78d17ae5aa
6 changes: 6 additions & 0 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,9 @@ function read(fd, buffer, offset, length, position, callback) {

validateOffsetLengthRead(offset, length, buffer.byteLength);

if(typeof position === 'bigint')
throw new ERR_INVALID_ARG_TYPE('position', 'number', position);

if (!NumberIsSafeInteger(position))
position = -1;

Expand Down Expand Up @@ -595,6 +598,9 @@ function readSync(fd, buffer, offset, length, position) {

validateOffsetLengthRead(offset, length, buffer.byteLength);

if(typeof position === 'bigint')
throw new ERR_INVALID_ARG_TYPE('position', 'number', position);

if (!NumberIsSafeInteger(position))
position = -1;

Expand Down