doc,test: mem protection must be observed in ffi#62818
Open
bengl wants to merge 3 commits intonodejs:mainfrom
Open
doc,test: mem protection must be observed in ffi#62818bengl wants to merge 3 commits intonodejs:mainfrom
bengl wants to merge 3 commits intonodejs:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62818 +/- ##
==========================================
- Coverage 91.55% 89.62% -1.93%
==========================================
Files 356 706 +350
Lines 149601 219136 +69535
Branches 23395 41982 +18587
==========================================
+ Hits 136967 196410 +59443
- Misses 12371 14618 +2247
- Partials 263 8108 +7845 🚀 New features to boost your workflow:
|
Contributor
|
Codewise it LGTM! |
addaleax
reviewed
Apr 19, 2026
| '-p', | ||
| ` | ||
| const ffi = require('node:ffi'); | ||
| const { functions } = ffi.dlopen('${libraryPath}', ${symbols}) |
Member
There was a problem hiding this comment.
Suggested change
| const { functions } = ffi.dlopen('${libraryPath}', ${symbols}) | |
| const { functions } = ffi.dlopen(${JSON.stringify(libraryPath)}, ${symbols}) |
| #include <stdint.h> | ||
| #include <stdlib.h> | ||
| #include <string.h> | ||
| #include <sys/mman.h> |
Member
There was a problem hiding this comment.
The #ifdef _WIN32 below this line makes me assume that this file is also compiled on Windows, which means that this include here (and the actual function that was added) should probably be in #ifndef _WIN32 guards?
When using ffi.toBuffer, memory protection on any memory pages exposed must be observed by the caller, otherwise crashes will occur. Now documented, and tested.
43f68d7 to
b448d7f
Compare
f3d4109 to
48ebb7a
Compare
Collaborator
Contributor
|
@bengl https://ci.nodejs.org/job/node-test-binary-windows-js-suites/40143/ - This is the only relevant failure. |
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using ffi.toBuffer, memory protection on any memory pages exposed must be observed by the caller, otherwise crashes will occur.
Now documented, and tested.