Skip to content

Conversation

simolus3
Copy link
Contributor

This fixes two issues:

  1. When binding a JS ArrayBuffer as a blob value, we used to pass the underlying data pointer of the buffer to the shared_ptr constructor. This makes the value take ownership of the underlying contents, which is not correct! The JS engine keeps ownership of data, we should clone instead. Binding the buffer causes a duplicate free when the JS engine eventually collects garbage, crashing the app.
  2. When reading SQLITE_BLOB values, memcpy was called on an uninitialized uint8_t *. Writing into the uninitialized pointer is undefined behavior (crashing the app is a best-case scenario here).

@simolus3 simolus3 requested a review from stevensJourney May 13, 2025 14:21
@simolus3 simolus3 merged commit e3f5c79 into main May 13, 2025
3 checks passed
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.

2 participants