sqlite: reject statement-less SQL in SQLTagStore · nodejs/node@83169e5 · GitHub
Skip to content

Commit 83169e5

Browse files
TrevorBurnhamaduh95
authored andcommitted
sqlite: reject statement-less SQL in SQLTagStore
sqlite3_prepare_v2() returns SQLITE_OK without producing a statement when its input holds no SQL, such as a comment. PrepareStatement() only checked the return code, so it cached a StatementSync wrapping a null sqlite3_stmt. Executing it reached sqlite3_clear_bindings(), which only guards against a null statement under SQLITE_ENABLE_API_ARMOR, and segfaulted. Reject such input instead of caching it. The StatementSync methods already avoid the crash because their IsFinalized() guard treats a null statement as finalized. Fixes: #65149 Signed-off-by: Trevor Burnham <trevorburnham@gmail.com> PR-URL: #65157 Fixes: #65149 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent f45dc92 commit 83169e5

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

src/node_sqlite.cc

Lines changed: 8 additions & 0 deletions

test/parallel/test-sqlite-template-tag.js

Lines changed: 23 additions & 0 deletions

0 commit comments

Comments
 (0)