sqlite: check sqlite3_step() and sqlite3_reset() results#63319
Open
semimikoh wants to merge 1 commit into
Open
sqlite: check sqlite3_step() and sqlite3_reset() results#63319semimikoh wants to merge 1 commit into
semimikoh wants to merge 1 commit into
Conversation
Collaborator
|
Review requested:
|
fd05a3c to
557bcde
Compare
Signed-off-by: semimikoh <ejffjeosms@gmail.com>
557bcde to
4740589
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #63319 +/- ##
==========================================
+ Coverage 90.04% 90.05% +0.01%
==========================================
Files 714 714
Lines 225338 225361 +23
Branches 42598 42614 +16
==========================================
+ Hits 202897 202942 +45
+ Misses 14236 14190 -46
- Partials 8205 8229 +24
🚀 New features to boost your workflow:
|
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.
Summary
Per the SQLite docs,
sqlite3_reset(S)may return a deferred error codefrom the prior
sqlite3_step(S)call. Several statement execution paths insrc/node_sqlite.ccdropped that return value, which could silently ignoreSQLite errors.
This also checks the previously ignored
sqlite3_step()result inStatementExecutionHelper::Run().Fixes: #63311
Approach
Successful execution paths now explicitly check
sqlite3_reset().Functions with early-return or V8-exception paths keep an
OnScopeLeavereset guard so prepared statements are left reusable. The guard intentionally
drops the reset result to avoid replacing an already-pending SQLite or V8
exception.
StatementSyncIterator::Next()andStatementSyncIterator::Return()use adirect checked reset because their control flow is linear.