GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — sqlite: reject statement-less SQLTagStore queries by lazerg · Pull Request #65152 · nodejs/node

Conversation

@lazerg

@lazerg lazerg commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Fixes: #65149

A query that holds no statement, such as sql.run`-- comment`, segfaults every SQLTagStore method. sqlite3_prepare_v2() returns SQLITE_OK with a null sqlite3_stmt* for input that is only a comment or whitespace, and ResetAndBindStatement() passes that null pointer straight to sqlite3_clear_bindings().

StatementSync already models a null statement as finalized, so this checks for it and throws ERR_INVALID_STATE, the same error db.prepare('-- comment').run() gives today.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@lazerg
sqlite: reject statement-less SQLTagStore queries
320810c
Signed-off-by: Lazizbek Ergashev <[email protected]>
@nodejs-github-bot

nodejs-github-bot commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/sqlite
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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 Aug 9, 2026
@codecov

codecov Bot commented Aug 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.32%. Comparing base (a876a12) to head (3ff24e1).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #65152   +/-   ##
=======================================
  Coverage   90.32%   90.32%           
=======================================
  Files         759      759           
  Lines      248325   248345   +20     
  Branches    46861    46875   +14     
=======================================
+ Hits       224303   224322   +19     
+ Misses      15467    15462    -5     
- Partials     8555     8561    +6     
Files with missing lines Coverage Δ
src/node_sqlite.cc 81.39% <100.00%> (+0.16%) ⬆️

... and 31 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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

islandryu
islandryu approved these changes Aug 9, 2026
View reviewed changes
Renegade334
Renegade334 reviewed Aug 9, 2026
View reviewed changes

@Renegade334 Renegade334 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

#65157 is the correct approach here, there's no point in allowing a null statement to be constructed and added to the tag store cache in the first place. We should reject these at the point of preparation.

That being said, this should also be the case for db.prepare()

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
meixg
meixg reviewed Aug 9, 2026
View reviewed changes
Comment thread src/node_sqlite.cc Resolved

Uh oh!

There was an error while loading. Please reload this page.

@lazerg
sqlite: clarify statement-less query error message
3ff24e1
Signed-off-by: Lazizbek Ergashev <[email protected]>
@Renegade334

Renegade334 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Closing in favour of #65157.

I would recommend not opening PRs within seconds of an issue being opened. There is often discussion to take place, even if the issue seems straightforward as in this case.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Renegade334 Renegade334 closed this Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Renegade334 Renegade334 Renegade334 left review comments
@meixg meixg meixg left review comments
@islandryu islandryu islandryu approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

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

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

sqlite: segfault when a SQLTagStore query contains only a comment

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@lazerg @nodejs-github-bot @Renegade334 @meixg @islandryu
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.