Skip to content

ffi: reject detached ArrayBuffers as pointers - #65083

Open
trivikr wants to merge 3 commits into
nodejs:mainfrom
trivikr:ffi-detached-arraybuffers-null
Open

ffi: reject detached ArrayBuffers as pointers#65083
trivikr wants to merge 3 commits into
nodejs:mainfrom
trivikr:ffi-detached-arraybuffers-null

Conversation

@trivikr

@trivikr trivikr commented Aug 6, 2026

Copy link
Copy Markdown
Member

Fixes: #65082

Reject detached ArrayBuffers and ArrayBuffer views in getRawPointer() and FFI pointer argument conversion. This prevents detached backing stores from being silently passed to native functions as null pointers.


Assisted-by: codex:gpt-5.6-sol

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/ffi

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Aug 6, 2026
@trivikr trivikr added ffi Issues and PRs related to experimental Foreign Function Interface support. request-ci Add this label to start a Jenkins CI on a PR. labels Aug 6, 2026
@trivikr
trivikr force-pushed the ffi-detached-arraybuffers-null branch from 2a099ed to 3713f90 Compare August 6, 2026 15:21
trivikr added 3 commits August 6, 2026 19:58
Reject detached ArrayBuffers and ArrayBuffer views in getRawPointer()
and FFI pointer argument conversion. This prevents detached backing
stores from being silently passed to native functions as null pointers.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: codex:gpt-5.6-sol
Report that the ArrayBuffer is detached instead of describing its
backing store as invalid.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@trivikr
trivikr force-pushed the ffi-detached-arraybuffers-null branch from 3713f90 to 6aa48c5 Compare August 7, 2026 02:58
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.31%. Comparing base (6c862f4) to head (6aa48c5).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65083      +/-   ##
==========================================
+ Coverage   90.29%   90.31%   +0.01%     
==========================================
  Files         759      759              
  Lines      248295   248313      +18     
  Branches    46861    46865       +4     
==========================================
+ Hits       224205   224260      +55     
+ Misses      15517    15472      -45     
- Partials     8573     8581       +8     
Files with missing lines Coverage Δ
src/ffi/data.cc 75.16% <100.00%> (+1.17%) ⬆️
src/ffi/types.cc 54.20% <100.00%> (+0.82%) ⬆️

... and 28 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. ffi Issues and PRs related to experimental Foreign Function Interface support. needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ffi: Detached ArrayBuffers and views are silently converted to null FFI pointers

2 participants