Skip to content

Commit 41b0999

Browse files
committed
fs: throws error if position argument is bigint
Fixes: nodejs#36190
1 parent 700612f commit 41b0999

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/fs.js

+6
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,9 @@ function read(fd, buffer, offset, length, position, callback) {
543543

544544
validateOffsetLengthRead(offset, length, buffer.byteLength);
545545

546+
if(typeof position === 'bigint')
547+
throw new ERR_INVALID_ARG_TYPE('position', 'number', position);
548+
546549
if (!NumberIsSafeInteger(position))
547550
position = -1;
548551

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

596599
validateOffsetLengthRead(offset, length, buffer.byteLength);
597600

601+
if(typeof position === 'bigint')
602+
throw new ERR_INVALID_ARG_TYPE('position', 'number', position);
603+
598604
if (!NumberIsSafeInteger(position))
599605
position = -1;
600606

0 commit comments

Comments
 (0)