Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy data into V8 memory cage instead #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gniezen
Copy link

@gniezen gniezen commented Feb 7, 2023

Since Electron v21 there is a V8 memory cage/sandbox that has been enabled, which prevents native modules from pointing to external memory.

The fix is to copy externally-created buffers into th V8 memory cage before passing them to JavaScript:
https://www.electronjs.org/blog/v8-memory-cage#i-want-to-refactor-a-node-native-module-to-support-electron-21-how-do-i-do-that

Without this fix the Electron render process crashes when getAlignedBuffer() is called. I've tested that this fix works on Windows 11 and MacOS Ventura.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant