Skip to content

inspect, pretty_format, ipc, yaml: harden recursive walkers against stack overflow and dangling state - #34889

Closed
robobun wants to merge 4 commits into
mainfrom
farm/76c712bf/formatter-stack-safety
Closed

inspect, pretty_format, ipc, yaml: harden recursive walkers against stack overflow and dangling state#34889
robobun wants to merge 4 commits into
mainfrom
farm/76c712bf/formatter-stack-safety

test: drop undrained stdout pipes and exact-empty stderr asserts

63e92e6
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 21, 2026 in 21m 13s

Code review found 1 potential issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit test/js/bun/util/inspect.test.js:341-357 Deep-JSX console.log test may emit O(N²) bytes to stdout

Annotations

Check warning on line 357 in test/js/bun/util/inspect.test.js

See this annotation in the file changed.

@claude claude / Claude Code Review

Deep-JSX console.log test may emit O(N²) bytes to stdout

The "deep JSX tree" case here can push O(N²) bytes to the pipe before the RangeError fires: `print_jsx` writes `">\n"` + `write_indent_n(self.indent)` (2×indent spaces) at every level *before* recursing and never increments `self.depth`, so nothing bounds it except the stack check — plausibly thousands of levels in a release build ⇒ tens of MB flushed to stdout and then materialised as one JS string in the parent via `proc.stdout.text()` before `toEndWith` runs. The Proxy variant sharing this `i