Skip to content

Tags: oven-sh/bun

Tags

bun-v1.2.21

Toggle bun-v1.2.21's commit message
De-flake shell-load.test.ts

bun-v1.2.20

Toggle bun-v1.2.20's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fix integer cast truncation panic on Windows for buffers > 4GB (#21738)

## Summary
This PR fixes a panic that occurs when file operations use buffers
larger than 4GB on Windows.

## The Problem
When calling `fs.readSync()` or `fs.writeSync()` with buffers larger
than 4,294,967,295 bytes (u32::MAX), Bun panics with:
```
panic(main thread): integer cast truncated bits
```

## Root Cause
The Windows APIs `ReadFile()` and `WriteFile()` expect a `DWORD` (u32)
for the buffer length parameter. The code was using `@intCast` to
convert from `usize` to `u32`, which panics when the value exceeds
u32::MAX.

## The Fix
Changed `@intCast` to `@truncate` in four locations:
1. `sys.zig:1839` - ReadFile buffer length parameter
2. `sys.zig:1556` - WriteFile buffer length parameter  
3. `bun.zig:230` - platformIOVecCreate length field
4. `bun.zig:240` - platformIOVecConstCreate length field

With these changes, operations with buffers > 4GB will read/write up to
4GB at a time instead of panicking.

## Test Plan
```js
// This previously caused a panic on Windows
const fs = require('fs');
const fd = fs.openSync('test.txt', 'r');
const buffer = Buffer.allocUnsafe(4_294_967_296); // 4GB + 1 byte
fs.readSync(fd, buffer, 0, buffer.length, 0);
```

Fixes #21699

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Jarred Sumner <[email protected]>
Co-authored-by: Claude <[email protected]>

bun-v1.2.19

Toggle bun-v1.2.19's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Update interactive spacing (#21156)

Co-authored-by: Claude Bot <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: RiskyMH <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <[email protected]>

bun-v1.2.18

Toggle bun-v1.2.18's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fixes #20753 (#20789)

Co-authored-by: Jarred-Sumner <[email protected]>

bun-v1.2.17

Toggle bun-v1.2.17's commit message
Some docs

bun-v1.2.16

Toggle bun-v1.2.16's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
add opencode-ai to trusted dependencies (#20330)

bun-v1.2.15

Toggle bun-v1.2.15's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Implement automatic workspace folders support for Chrome DevTools (#1…

…9949)

bun-v1.2.14

Toggle bun-v1.2.14's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
node:net compat: Invalid port test for .listen (#19768)

bun-v1.2.13

Toggle bun-v1.2.13's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Delete .node files from bun build --compile after dlopen (#19551)

Co-authored-by: 190n <[email protected]>

bun-v1.2.12

Toggle bun-v1.2.12's commit message
Fix the doc page for html