Skip to content

sqlite: segfault when a SQLTagStore query contains only a comment #65149

Description

@TrevorBurnham

Version

v27.0.0-pre (main @ e2d7b34); reproduces on any build containing 8fc7341

Platform

Darwin 25.6.0 arm64

Subsystem

sqlite

What steps will reproduce the bug?

const { DatabaseSync } = require('node:sqlite');
const db = new DatabaseSync(':memory:');
const store = db.createTagStore();
store.run`-- comment`;

How often does it reproduce? Is there a required condition?

Always. All four query methods crash: run, get, all, and iterate.

What is the expected behavior? Why is that the expected behavior?

A thrown error, like the equivalent non-tag-store path produces:

db.prepare('-- comment').run();  // throws: statement has been finalized

What do you see instead?

A segfault:

* thread #1, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  frame #0: sqlite3_clear_bindings(pStmt=0x0000000000000000) at sqlite3.c:93850
  frame #1: node::sqlite::SQLTagStore::ResetAndBindStatement(...) at node_sqlite.cc:3442
  frame #2: node::sqlite::SQLTagStore::Run(...) at node_sqlite.cc:3477

Additional information

The crash appears to have been introduced by #65041.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions