fix integer overflow in ReadFile buffer capacity computation#28849
Closed
robobun wants to merge 3 commits into
Closed
fix integer overflow in ReadFile buffer capacity computation#28849robobun wants to merge 3 commits into
robobun wants to merge 3 commits into
Claude / Claude Code Review
completed
Apr 4, 2026 in 23m 9s
Code review found 1 potential issue
Found 1 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 0 |
| 🟣 Pre-existing | 1 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟣 Pre-existing | src/bun.js/webcore/blob/read_file.zig:384-392 |
doReadLoop bun.handleOom crashes vs. graceful initCapacity OOM path |
Annotations
Check notice on line 392 in src/bun.js/webcore/blob/read_file.zig
claude / Claude Code Review
doReadLoop bun.handleOom crashes vs. graceful initCapacity OOM path
This PR correctly makes the `initCapacity` OOM path graceful (sets `system_error`, rejects with ENOMEM), but `doReadLoop` still uses `bun.handleOom` for buffer growth during streaming reads — a pre-existing crash-on-OOM path. The fix makes the inconsistency more visible: `Bun.file("/dev/zero").slice(1).text()` now rejects gracefully, while `Bun.file("/dev/zero").text()` (no slice, `this.size=4096`, `initCapacity` succeeds) would still crash the process via `bun.handleOom` if the allocator runs O
Loading