Skip to content

ffi: validate DynamicLibrary getter receivers - #65288

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:fix-ffi-getter-crash
Open

ffi: validate DynamicLibrary getter receivers#65288
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:fix-ffi-getter-crash

Conversation

@trivikr

@trivikr trivikr commented Aug 14, 2026

Copy link
Copy Markdown
Member

Fixes: #65287

Check the receivers of the path, symbols, and functions getters before unwrapping them. This prevents incompatible receivers from crashing the process and makes the getters throw ERR_INVALID_THIS instead.


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 14, 2026
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.32%. Comparing base (91a99c5) to head (5768e16).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/node_ffi.cc 81.25% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65288      +/-   ##
==========================================
- Coverage   90.32%   90.32%   -0.01%     
==========================================
  Files         751      751              
  Lines      250000   249972      -28     
  Branches    47231    47227       -4     
==========================================
- Hits       225816   225784      -32     
- Misses      15566    15569       +3     
- Partials     8618     8619       +1     
Files with missing lines Coverage Δ
src/node_ffi.cc 71.05% <81.25%> (+0.31%) ⬆️

... and 26 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.

Check the receivers of the path, symbols, and functions getters before
unwrapping them. This prevents incompatible receivers from crashing the
process and makes the getters throw ERR_INVALID_THIS instead.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: codex:gpt-5.6-sol
@trivikr
trivikr force-pushed the fix-ffi-getter-crash branch from 29be2a9 to 5768e16 Compare August 14, 2026 16:58
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++. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ffi: DynamicLibrary getters crash on incompatible receivers

2 participants