mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 04:18:58 +00:00
## 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>