summaryrefslogtreecommitdiff
path: root/lib/fs.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fs.js')
-rw-r--r--lib/fs.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/fs.js b/lib/fs.js
index 780940b4f4..f0a9b676b3 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -2009,12 +2009,12 @@ function ReadStream(path, options) {
this.closed = false;
if (this.start !== undefined) {
- if (typeof this.start !== 'number') {
+ if (typeof this.start !== 'number' || Number.isNaN(this.start)) {
throw new ERR_INVALID_ARG_TYPE('start', 'number', this.start);
}
if (this.end === undefined) {
this.end = Infinity;
- } else if (typeof this.end !== 'number') {
+ } else if (typeof this.end !== 'number' || Number.isNaN(this.end)) {
throw new ERR_INVALID_ARG_TYPE('end', 'number', this.end);
}
@@ -2031,6 +2031,8 @@ function ReadStream(path, options) {
// (That is a semver-major change).
if (typeof this.end !== 'number')
this.end = Infinity;
+ else if (Number.isNaN(this.end))
+ throw new ERR_INVALID_ARG_TYPE('end', 'number', this.end);
if (typeof this.fd !== 'number')
this.open();