Skip to content

Commit

Permalink
fs: throws error if position argument is bigint
Browse files Browse the repository at this point in the history
  • Loading branch information
darvesh committed Nov 20, 2020
1 parent 700612f commit 41b0999
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/fs.js
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

0 comments on commit 41b0999

Please sign in to comment.