Skip to content

ffi: reject detached ArrayBufferViews - #65086

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:ffi-export-arraybufferview-detached-handling
Open

ffi: reject detached ArrayBufferViews#65086
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:ffi-export-arraybufferview-detached-handling

Conversation

@trivikr

@trivikr trivikr commented Aug 6, 2026

Copy link
Copy Markdown
Member

Fixes: #65085

Detached ArrayBuffers were rejected with ERR_INVALID_ARG_VALUE, but detached views were not: typed arrays exported zero bytes and DataViews threw a bare TypeError from byteLength.

Track detachment in ArrayBufferViewContents::Read() and skip the JS length check for detached buffers, so every detached input is rejected.


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++. ffi Issues and PRs related to experimental Foreign Function Interface support. needs-ci PRs that need a full CI run. labels Aug 6, 2026
Detached ArrayBuffers were rejected with ERR_INVALID_ARG_VALUE, but
detached views were not: typed arrays exported zero bytes and DataViews
threw a bare TypeError from byteLength.

Track detachment in ArrayBufferViewContents::Read() and skip the JS
length check for detached buffers, so every detached input is rejected.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: codex:gpt-5.6-sol
@trivikr
trivikr force-pushed the ffi-export-arraybufferview-detached-handling branch from 989c399 to 6a14197 Compare August 6, 2026 18:25
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ffi: exportArrayBufferView() inconsistently handles detached views

2 participants