| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Review requested:
|
Sorry, something went wrong.
Codecov Report❌ Patch coverage is 61.53846% with 10 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## main #65106 +/- ##
========================================
Coverage 90.31% 90.32%
========================================
Files 759 760 +1
Lines 248290 248551 +261
Branches 46859 46918 +59
========================================
+ Hits 224241 224501 +260
+ Misses 15472 15460 -12
- Partials 8577 8590 +13
... and 69 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
|
@trivikr I've addressed the issues you noted. The format-cpp check is now timing out after 15 minutes ("The operation was canceled"); the same check succeeds locally. |
Sorry, something went wrong.
Sorry, something went wrong.
Commit Queue failed- Loading data for nodejs/node/pull/65106 ✔ Done loading data for nodejs/node/pull/65106 ----------------------------------- PR info ------------------------------------ Title sqlite: reject reentry into a running statement (#65106) Author Trevor Burnham <trevorburnham@gmail.com> (@TrevorBurnham) Branch TrevorBurnham:sqlite/guard-statement-reentry -> nodejs:main Labels c++, author ready, needs-ci, commit-queue, sqlite Commits 1 - sqlite: reject reentry into a running statement Committers 1 - Trevor Burnham <trevorburnham@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65106 Fixes: https://github.com/nodejs/node/issues/65102 Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/65106 Fixes: https://github.com/nodejs/node/issues/65102 Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> -------------------------------------------------------------------------------- ℹ This PR was created on Fri, 07 Aug 2026 14:58:01 GMT ✔ Approvals: 1 ✔ - Trivikram Kamat (@trivikr): https://github.com/nodejs/node/pull/65106#pullrequestreview-4889248717 ✘ This PR needs to wait 113 more hours to land (or 0 minutes if there is one more approval) ✔ Last GitHub CI successful ℹ Last Full PR CI on 2026-08-08T17:08:25Z: https://ci.nodejs.org/job/node-test-pull-request/75659/ - Querying data for job/node-test-pull-request/75659/ ✔ Build data downloaded ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /Users/avivkeller/Documents/projects/nodejs/node/.ncu/nodejs/node/actions/runs/ |
Sorry, something went wrong.
SQLite forbids stepping, resetting, or finalizing a statement while that statement's own user-defined function callback is on the stack. The callback depth added in 5cef767 is tracked per database, so it cannot tell reentry into the running statement apart from the common pattern of querying a different statement from a callback. Mark the statement being executed and reject step, reset, and finalize on that statement with ERR_INVALID_STATE. Statements other than the running one are unaffected. Reentry corrupts the running virtual machine rather than merely producing a wrong answer. Resetting from a callback halts a VM whose sqlite3_step() frame is still live, so a bounded reentrant get() or run(), and iterator.return() with its bare sqlite3_reset(), all segfault; from an aggregate's step or result callback the same reset tears down aggregate state mid-xValue and aborts on a CHECK in a release build. Where it does not crash it is still wrong: a reentrant iterator.next() silently consumed rows from the iteration in progress, and a recursive get() surfaced a V8 stack overflow instead of the constraint. close() and [Symbol.dispose]() are covered too, since finalizing mid-step frees the running VM. The mark is set before parameters are bound, so a getter or valueOf() that reenters while its own arguments are being evaluated is rejected as well. Without this, two iterators could share one virtual machine and interleave rows from a single result set. Signed-off-by: Trevor Burnham <trevorburnham@gmail.com> Assisted-by: claude:opus-5
|
^ Updated the PR to cover sqlite3_reset. The PR description has been updated as well. |
Sorry, something went wrong.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes: #65102
SQLite forbids stepping, resetting, or finalizing a statement while that statement's own user-defined function callback is on the stack. The callback depth added in 5cef767 (#64743) is tracked per database, so it cannot distinguish reentry into the running statement from the common pattern of querying a different statement from a callback.
This PR adds a per-statement flag, set for the duration of an execution, and rejects step/reset/finalize on that statement with ERR_INVALID_STATE: statement is currently being executed.
Severity
Reentry corrupts the running virtual machine. Resetting from a callback halts a VM whose sqlite3_step() frame is still live:
Verified on v24.15.0 and current main. The crash needs the reentry to be bounded — the repros in #65102 recurse without limit, so V8's stack overflows before control returns into the corrupted step(), which is why that issue concluded it was correctness-only.
The aggregate row is a distinct corruption path: the reentrant reset tears down aggregate state mid-xValue, tripping the CHECK in CustomAggregate::DestroyAggregateData. That CHECK is compiled into release builds, so it aborts in production rather than only under a debug build.
Covered entry points: all(), get(), run(), iterate(), iterator.next(), iterator.return(), close(), [Symbol.dispose](), and the four SQL tag store methods. close() and [Symbol.dispose]() are included because finalizing mid-step frees the virtual machine that sqlite3_step() is still executing.
Prior art: #63183 took this approach alongside its own database-level guard. That PR was closed once #64743 landed, so this salvages the per-statement half and builds on the guard already in main.