Skip to content

Conversation

@malshoff
Copy link
Contributor

@malshoff malshoff commented May 9, 2025

Electron switched to using v8's sandboxing feature as of V21. With this enabled, allocating a buffer using node::Buffer::New crashes the program, because it attempts to allocate memory outside of the allowed memory address range of the sandbox.

[23992:0508/184214.301:ERROR:node_bindings.cc(162)] Fatal error in V8: v8_ArrayBuffer_NewBackingStore When the V8 Sandbox is enabled, ArrayBuffer backing stores must be allocated inside the sandbox address space. Please use an appropriate ArrayBuffer::Allocator to allocate these buffers, or disable the sandbox.

Reproducing the issue is as simple as calling db.serialize() in Electron versions 30.0 and higher.

PR #1036 fixed this for electron versions until 30.x.x+, where this fix broke. Why this only broke in the most recent Electron versions, I'm not sure, but there were 2 issues:

I tested the minimum repro with these changes inside of an Electron app, and it behaves as expected now. (#1372 )

Copy link
Member

@mceachen mceachen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this research!

@JoshuaWise JoshuaWise merged commit 395af82 into WiseLibs:master May 19, 2025
22 checks passed
mceachen pushed a commit to mceachen/better-sqlite3 that referenced this pull request May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants