mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 19:38:58 +00:00
This prevents crashes when setting URL properties (like pathname) to objects with deeply recursive toString() methods. The fix adds stack safety checks in two key locations: 1. URL pathname setter - checks stack before attempting string conversion 2. String conversion functions (valueToUSVString, valueToByteString, etc.) - checks stack before calling toWTFString/toString When the stack is near its limit, a RangeError is thrown instead of crashing with an ASAN assertion failure or stack overflow. Tests verify that: - Limited recursion (100 calls) throws a proper error instead of crashing - toString methods that modify URLs work correctly - Deep recursion (10000 calls) either succeeds or throws RangeError Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>