sqlite: prevent reentrant session.close()

Reject session.close() while generating a changeset or patchset.
Closing the session at that point frees it while SQLite is still
using it, causing a use-after-free.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: codex:gpt-5.6-sol
PR-URL: https://github.com/nodejs/node/pull/65349
Fixes: https://github.com/nodejs/node/issues/65347
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
This commit is contained in:
Trivikram Kamat authored and Antoine du Hamel committed 2026-08-26 00:56:11 +02:00
1 parent 810929b6dd
commit e2f952f2ff
4 files changed
+31 -1

No files matched your search

+2 -1
View File
@@ -1005,7 +1005,8 @@ wrapper around [`sqlite3session_patchset()`][].
### `session.close()`
Closes the session. An exception is thrown if the database or the session is not open. This method is a
Closes the session. An exception is thrown if the database or the session is not open,
or if the session is currently generating a changeset or patchset. This method is a
wrapper around [`sqlite3session_delete()`][].
### `session[Symbol.dispose]()`