sqlite: reject reentry while binding parameters - #65294
Open
TrevorBurnham wants to merge 1 commit into
Open
Conversation
c4b755e tracks the statements currently being stepped and rejects reentry into them, but the guard is established inside the execution helpers, after the entry point has already reset the statement and bound its parameters. Binding reads properties off the supplied object, so a named-parameter getter runs JavaScript in that window. Reentering the same statement there resets it a second time and, for iterate(), hands out a second iterator; both iterators record the same reset generation, so neither is invalidated and they interleave rows from one virtual machine. Establish the guard at the four StatementSync entry points instead, before the reset, so it spans binding as well as stepping. The existing guards inside the helpers are left in place; the stepping set is a stack, so the nested acquisition is balanced. Signed-off-by: Trevor Burnham <trevorburnham@gmail.com> Assisted-by: claude:opus-5
Collaborator
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65294 +/- ##
==========================================
- Coverage 90.33% 90.30% -0.03%
==========================================
Files 751 751
Lines 250048 250239 +191
Branches 47254 47300 +46
==========================================
+ Hits 225877 225990 +113
- Misses 15553 15620 +67
- Partials 8618 8629 +11
🚀 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.
Follow-up for #65156. That PR added tracking for the statements currently being stepped and rejects reentry into them. The guard is established inside the execution helpers, though, which the entry points reach only after resetting the statement and binding its parameters.
Binding reads properties off the supplied object, so a named-parameter getter runs JavaScript in that window. On current
main:Two live iterators over one virtual machine. The reset-generation check does not catch it because the inner
iterate()bumps the generation before the outer iterator is constructed, so both record the same value and neither is invalidated.This PR hoists the guard to the four
StatementSyncentry points, before the reset, so it spans binding as well as stepping. The guards inside the helpers are left alone;stepping_statements_is a stack, so the nested acquisition is balanced. It also adds test cases salvaged from #65106, which was superseded by #65156.