GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tty: validate file descriptor to avoid int32 overflow · nodejs/node@d89d55a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • tty.js
  • test/pseudo-tty
    • test-tty-isatty.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/tty.js‎

Copy file name to clipboardExpand all lines: lib/tty.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ const {
4040
let readline;
4141

4242
function isatty(fd) {
43-
return NumberIsInteger(fd) && fd >= 0 && isTTY(fd);
43+
return NumberIsInteger(fd) && fd >= 0 && fd <= 2147483647 &&
44+
isTTY(fd);
4445
}
4546

4647
function ReadStream(fd, options) {
Collapse file

‎test/pseudo-tty/test-tty-isatty.js‎

Copy file name to clipboardExpand all lines: test/pseudo-tty/test-tty-isatty.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ strictEqual(isatty(2), true, 'stderr reported to not be a tty, but it is');
1010

1111
strictEqual(isatty(-1), false, '-1 reported to be a tty, but it is not');
1212
strictEqual(isatty(55555), false, '55555 reported to be a tty, but it is not');
13+
strictEqual(isatty(2 ** 31), false, '2^31 reported to be a tty, but it is not');
1314
strictEqual(isatty(1.1), false, '1.1 reported to be a tty, but it is not');
1415
strictEqual(isatty('1'), false, '\'1\' reported to be a tty, but it is not');
1516
strictEqual(isatty({}), false, '{} reported to be a tty, but it is not');

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.