-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: fix OOB reads in process.title getter #31633
Changes from all commits
0d0ce7a
9e1203e
644aae6
0ff7bef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const { spawnSync } = require('child_process'); | ||
const { strictEqual } = require('assert'); | ||
|
||
// FIXME add sunos support | ||
if (common.isSunOS) | ||
common.skip(`Unsupported platform [${process.platform}]`); | ||
// FIXME add IBMi support | ||
if (common.isIBMi) | ||
common.skip('Unsupported platform IBMi'); | ||
|
||
// Explicitly assigning to process.title before starting the child process | ||
// is necessary otherwise *its* process.title is whatever the last | ||
// SetConsoleTitle() call in our process tree set it to. | ||
// Can be removed when https://github.com/libuv/libuv/issues/2667 is fixed. | ||
if (common.isWindows) | ||
process.title = process.execPath; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See libuv/libuv#2667 - I believe this is a Windows-only libuv bug. Until it's fixed, it's best to call it out explicitly. |
||
|
||
const xs = 'x'.repeat(1024); | ||
const proc = spawnSync(process.execPath, ['-p', 'process.title', xs]); | ||
strictEqual(proc.stdout.toString().trim(), process.execPath); | ||
addaleax marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking for this PR, but... in the future, might it be possible to introduce a variant of
uv_get_process_title
that can optionally report the size of the buffer required? something along the lines of...Definitely minor but a bit nicer to avoid the multiple resize operations