Skip to content

sqlite: bind empty ArrayBuffer as empty blob - #67657

Open
araujogui wants to merge 2 commits into
nodejs:mainfrom
araujogui:sqlite-empty-arraybuffer
Open

araujogui wants to merge 2 commits into
nodejs:mainfrom
araujogui:sqlite-empty-arraybuffer

Conversation

@araujogui

@araujogui araujogui commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Use sqlite3_bind_zeroblob()/sqlite3_result_zeroblob() for zero-length buffers instead of passing a possibly-null data pointer, which SQLite treats as NULL.

On main, empty views were already fixed indirectly by #62343, but empty ArrayBuffer/SharedArrayBuffer values were still bound, and returned from user-defined functions, as NULL. Detached ArrayBuffers now also bind as empty blobs, matching views on detached buffers.

Fixes: #67188

A zero-length ArrayBuffer or SharedArrayBuffer can have a null data
pointer, and SQLite treats a null blob pointer as NULL. As a result,
such values were bound as parameters, and returned from user-defined
functions, as NULL instead of an empty blob.

Use sqlite3_bind_zeroblob() and sqlite3_result_zeroblob() for empty
buffers.

Fixes: nodejs#67188
Refs: nodejs#62061
Assisted-by: Claude Opus 5.5
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 20, 2026 13:44
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/sqlite

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@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. sqlite Issues and PRs related to the SQLite subsystem. labels Nov 20, 2026
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. sqlite Issues and PRs related to the SQLite subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sqlite: binding a zero-length Uint8Array to a parameter can result in NULL

3 participants