mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 05:42:43 +00:00
The FFI `JSVALUE_TO_PTR` function was missing support for ArrayBuffer objects, causing segfaults when ArrayBuffers were passed as pointer arguments to FFI functions. TypedArrays and DataViews worked correctly, but ArrayBuffers fell through to number-as-pointer conversion logic, resulting in invalid pointers. Changes: - Add `JSC__JSValue__toArrayBufferPtr` C++ helper function to extract ArrayBuffer data pointer - Add `JSCELL_IS_ARRAY_BUFFER` helper function for type detection - Update `JSVALUE_TO_PTR` in FFI.h to handle ArrayBuffer case - Add JSTypeArrayBuffer constant (value 38) for type detection - Integrate ArrayBuffer support into FFI symbol table - Add regression test to prevent future issues - Add test/js/bun/ffi/*.so to .gitignore to prevent committing compiled FFI test binaries Fixes: ArrayBuffer, TypedArray, and DataView now all work identically when passed as pointer arguments to FFI functions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>