Skip to content

Fix crash in Bun.file().writer() with invalid path/fd options - #30277

Closed
robobun wants to merge 1 commit into
mainfrom
farm/0f0eae96/filesink-writer-invalid-options
Closed

Fix crash in Bun.file().writer() with invalid path/fd options#30277
robobun wants to merge 1 commit into
mainfrom
farm/0f0eae96/filesink-writer-invalid-options

Fix crash in Bun.file().writer() with invalid path/fd options

b1d0aa8
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed May 5, 2026 in 8m 10s

Code review found 1 potential issue

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

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/runtime/webcore/Blob.zig:2977 FileSink leaked when fromJSWithTag throws (JSError path)

Annotations

Check warning on line 2977 in src/runtime/webcore/Blob.zig

See this annotation in the file changed.

@claude claude / Claude Code Review

FileSink leaked when fromJSWithTag throws (JSError path)

Nit: the `try` on this line can also early-return (e.g. `{ get highWaterMark() { throw 1 } }`), in which case `sink` from line 2954 is leaked — there's no `errdefer sink.deref()`. Since this PR is already adding `sink.deref()` for the `.err` branch right below, an `errdefer sink.deref();` after line 2954 would cover this path (and the existing manual `sink.deref()` calls could then be dropped). Pre-existing, but it's the same hardening this PR is doing.