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

@christianaurichzm christianaurichzm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@christianaurichzm christianaurichzm added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Nov 20, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 20, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.73%. Comparing base (5884b8e) to head (a8da587).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67657      +/-   ##
==========================================
+ Coverage   90.71%   90.73%   +0.01%     
==========================================
  Files         801      801              
  Lines      280906   280966      +60     
  Branches    54249    54268      +19     
==========================================
+ Hits       254832   254930      +98     
+ Misses      16246    16200      -46     
- Partials     9828     9836       +8     
Files with missing lines Coverage Δ
src/node_sqlite.cc 82.98% <100.00%> (+0.06%) ⬆️

... and 30 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@christianaurichzm christianaurichzm added the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 20, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 20, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. 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

4 participants