Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
src: limit GetProcessTitle() result to 1MB
`GetProcessTitle()` otherwise runs an infinite loop when
`uv_setup_argv()` has not been called (yet). This is a problem
e.g. in assertions from static constructors, which run before
`main()` and thus before `argc` and `argv` become available.

To solve that, do not allocate more than 1MB of storage for the
title and bail out if we reach that point.
  • Loading branch information
addaleax committed Oct 4, 2020
commit 8ec4407417508bf9a31295a6a80a9ca9d46bab5b
2 changes: 1 addition & 1 deletion src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ std::string GetProcessTitle(const char* default_title) {
if (rc == 0)
break;

if (rc != UV_ENOBUFS)
if (rc != UV_ENOBUFS || buf.size() >= 1024 * 1024)
return default_title;

buf.resize(2 * buf.size());
Expand Down