sqlite: prevent reentrant statement finalization - #64796
Open
trivikr wants to merge 1 commit into
Open
Conversation
Collaborator
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #64796 +/- ##
==========================================
+ Coverage 90.14% 90.16% +0.01%
==========================================
Files 746 746
Lines 242763 242769 +6
Branches 45761 45769 +8
==========================================
+ Hits 218848 218900 +52
+ Misses 15402 15351 -51
- Partials 8513 8518 +5
🚀 New features to boost your workflow:
|
Track statement execution depth while calling sqlite3_step(). Reject close() and deserialize() while a statement is executing so callbacks cannot finalize the active statement and crash. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: codex:gpt-5.6-sol
trivikr
force-pushed
the
sqlite-reject-reentrant-close
branch
from
July 31, 2026 04:28
c11abfd to
4af37c6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes: #64795
A scalar or aggregate callback can call
db.close()while its preparedstatement is executing inside
sqlite3_step().close()then finalizes thecurrently executing statement, and execution resumes with an invalid statement,
causing the process to crash.
db.deserialize()has the same issue because italso finalizes existing statements.
This change tracks statement execution depth around
sqlite3_step()andrejects
close()anddeserialize()withERR_INVALID_STATEwhile a statementis executing.
Assisted-by: codex:gpt-5.6-sol