summaryrefslogtreecommitdiff
path: root/lib/tty.js
diff options
context:
space:
mode:
authorAntoine du Hamel <duhamelantoine1995@gmail.com>2021-03-19 10:48:02 +0100
committerAntoine du Hamel <duhamelantoine1995@gmail.com>2021-03-23 11:02:03 +0100
commit134fb5a8d0fd36b7675939877bad65b43cfc5ad4 (patch)
treeb068eee204fcb4b1f4174707bd1e7f1773fae860 /lib/tty.js
parent3bee6d8aad1666b26162d3a2d517c4fd5a9fe076 (diff)
downloadnode-new-134fb5a8d0fd36b7675939877bad65b43cfc5ad4.tar.gz
tty: validate file descriptor to avoid int32 overflow
Fixes: https://github.com/nodejs/node/issues/37805 PR-URL: https://github.com/nodejs/node/pull/37809 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Diffstat (limited to 'lib/tty.js')
-rw-r--r--lib/tty.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/tty.js b/lib/tty.js
index 106f8cc423..e61a5c3ac3 100644
--- a/lib/tty.js
+++ b/lib/tty.js
@@ -40,7 +40,8 @@ const {
let readline;
function isatty(fd) {
- return NumberIsInteger(fd) && fd >= 0 && isTTY(fd);
+ return NumberIsInteger(fd) && fd >= 0 && fd <= 2147483647 &&
+ isTTY(fd);
}
function ReadStream(fd, options) {