mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
This fixes a race condition in `napi_create_external_buffer` where the finalizer was added separately via `vm.heap.addFinalizer`, allowing native code to free/reuse the underlying memory while JavaScript still held a reference to the ArrayBuffer, causing data corruption. The fix ties the finalizer directly to the ArrayBuffer via `createFromBytes`, matching the pattern used in `napi_create_external_arraybuffer`. Fixes #26446 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>