Skip to content

path: bounds-check joinZBuf; fix fs.watch overflow near PATH_MAX - #29978

Closed
robobun wants to merge 4 commits into
mainfrom
farm/6a9d58b7/fs-watch-pathbuffer-overflow
Closed

path: bounds-check joinZBuf; fix fs.watch overflow near PATH_MAX#29978
robobun wants to merge 4 commits into
mainfrom
farm/6a9d58b7/fs-watch-pathbuffer-overflow

Merge branch 'main' into farm/6a9d58b7/fs-watch-pathbuffer-overflow

4daac00
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed May 1, 2026 in 35m 36s

Code review found 1 potential issue

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

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/resolver/resolve_path.zig:1261-1267 joinZBufWithoutBoundsCheck panics on ../-heavy inputs that pre-PR joinZBuf accepted

Annotations

Check warning on line 1267 in src/resolver/resolve_path.zig

See this annotation in the file changed.

@claude claude / Claude Code Review

joinZBufWithoutBoundsCheck panics on ../-heavy inputs that pre-PR joinZBuf accepted

Minor doc-accuracy note on "no behavior change when the result fits": that only holds when the *concatenated input* fits. `joinStringBufT` concatenates into a separately-sized `temp_buf` (heap-allocated when `count*2 > 4096`) and only writes the *normalized* output into `buf`, so pre-PR `joinZBuf` succeeded on `../`-heavy inputs whose concatenation exceeds `buf.len` but whose normalized result fits — the migrated `WithoutBoundsCheck` callers (e.g. shell `cp.zig:459`, `interpreter.zig:1843`) now