Files
bun.sh/src
robobun c8cb7713fc Fix Windows crash in process.title when console title is empty (#23184)
## Summary

Fixes a segmentation fault on Windows 11 when accessing `process.title`
in certain scenarios (e.g., when fetching system information or making
Discord webhook requests).

## Root Cause

The crash occurred in libuv's `uv_get_process_title()` at `util.c:413`
in the `strlen()` call. The issue is that `uv__get_process_title()`
could return success (0) but leave `process_title` as NULL in edge cases
where:

1. `GetConsoleTitleW()` returns an empty string
2. `uv__convert_utf16_to_utf8()` succeeds but doesn't allocate memory
for the empty string
3. The subsequent `assert(process_title)` doesn't catch this in release
builds
4. `strlen(process_title)` crashes with a null pointer dereference

## Changes

Added defensive checks in `BunProcess.cpp`:
1. Initialize the title buffer to an empty string before calling
`uv_get_process_title()`
2. Check if the buffer is empty after the call returns
3. Fall back to "bun" if the title is empty or the call fails

## Testing

Added regression test in `test/regression/issue/23183.test.ts` that
verifies:
- `process.title` doesn't crash when accessed
- Returns a valid string (either the console title or "bun")

Fixes #23183

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-03 02:54:23 -07:00
..
2025-09-30 05:26:32 -07:00
2025-09-30 05:26:32 -07:00
2025-10-01 17:16:25 -07:00
2025-07-21 13:26:47 -07:00
2025-09-30 05:26:32 -07:00
2025-09-27 00:45:29 -07:00
2025-09-09 20:41:10 -07:00
2025-09-30 05:26:32 -07:00
2025-09-30 05:26:32 -07:00
2025-09-27 00:45:29 -07:00
2025-07-21 13:26:47 -07:00
2025-07-29 19:35:46 -07:00
2025-09-30 05:26:32 -07:00
2025-09-30 05:26:32 -07:00
2025-09-30 16:13:23 -07:00
2025-07-21 13:26:47 -07:00
2025-10-02 18:43:10 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-08-27 06:39:11 -07:00
2025-09-09 20:41:10 -07:00
2025-09-30 05:26:32 -07:00
2025-09-11 23:29:53 -07:00
2025-09-09 20:41:10 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-09-09 20:41:10 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00