diff options
author | ZYSzys <17367077526@163.com> | 2019-02-10 12:16:53 +0800 |
---|---|---|
committer | Luigi Pinca <luigipinca@gmail.com> | 2019-02-10 09:22:36 +0100 |
commit | 70f4f08a9f0902056ac47271f9d3a761fcee4715 (patch) | |
tree | 18594addd9871c782463f4f52d2d1df74ce2d6ae /lib | |
parent | e154176b7cc397399ccb939b920b308f8d5cb874 (diff) | |
download | android-node-v8-70f4f08a9f0902056ac47271f9d3a761fcee4715.tar.gz android-node-v8-70f4f08a9f0902056ac47271f9d3a761fcee4715.tar.bz2 android-node-v8-70f4f08a9f0902056ac47271f9d3a761fcee4715.zip |
fs: harden validation of start option in createWriteStream
PR-URL: https://github.com/nodejs/node/pull/25579
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/fs/streams.js | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js index 501c9ee4d2..7174990ebb 100644 --- a/lib/internal/fs/streams.js +++ b/lib/internal/fs/streams.js @@ -243,13 +243,7 @@ function WriteStream(path, options) { this.closed = false; if (this.start !== undefined) { - if (typeof this.start !== 'number') { - throw new ERR_INVALID_ARG_TYPE('start', 'number', this.start); - } - if (this.start < 0) { - const errVal = `{start: ${this.start}}`; - throw new ERR_OUT_OF_RANGE('start', '>= 0', errVal); - } + checkPosition(this.start, 'start'); this.pos = this.start; } |