Files
bun.sh/test/js
Claude Bot 18b5301a7f Fix FFI segfault when passing ArrayBuffer as pointer argument (#22225)
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>
2025-08-29 09:43:43 +00:00
..
2024-12-12 02:07:29 -08:00
2025-08-27 15:06:26 -07:00
2025-08-27 06:39:11 -07:00
2025-08-22 12:08:42 -07:00
2025-08-27 06:39:11 -07:00