Skip to content

gh-162288: Fix UAF for statement_cache self->connection->statement_cache in sqlite3 - #162294

Draft
johng wants to merge 1 commit into
python:mainfrom
johng:r2-sqllite-ft
Draft

johng wants to merge 1 commit into
python:mainfrom
johng:r2-sqllite-ft

Conversation

@johng

@johng johng commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

This protects against a UAF from an execute and clear in two threads in a FT build and closing on execute which can execute arbituary python code before the execution (impacting GIL build too).

`sqllite`

This protects against a UAF from an execute and clear in two
thrads in a FT build and closing on `execute` which can execute
arbituary python code before the execution (impacting GIL build too).
@johng johng changed the title gh-162288: Fix UAF for statement_cache self->connection->statement_cache in gh-162288: Fix UAF for statement_cache self->connection->statement_cache in sqlite Nov 19, 2026
@johng johng changed the title gh-162288: Fix UAF for statement_cache self->connection->statement_cache in sqlite gh-162288: Fix UAF for statement_cache self->connection->statement_cache in sqlite3 Nov 19, 2026
Comment thread Modules/_sqlite/cursor.c
size_t nargsf = 1 | PY_VECTORCALL_ARGUMENTS_OFFSET;
return PyObject_Vectorcall(cache, args + 1, nargsf, NULL);
PyObject *stmt = PyObject_Vectorcall(cache, args + 1, nargsf, NULL);
Py_DECREF(cache);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we need to re-check the connection here is open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant