Skip to content

gh-92206: Improve scoping of sqlite3 taint statement helper #92260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Modules/_sqlite/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,12 @@ bind_parameters(pysqlite_state *state, pysqlite_Statement *self,
}
}

static inline void
stmt_mark_dirty(pysqlite_Statement *self)
{
self->in_use = 1;
}

PyObject *
_pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation, PyObject* second_argument)
{
Expand Down Expand Up @@ -844,7 +850,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
}

stmt_reset(self->statement);
pysqlite_statement_mark_dirty(self->statement);
stmt_mark_dirty(self->statement);

/* We start a transaction implicitly before a DML statement.
SELECT is the only exception. See #9924. */
Expand All @@ -863,7 +869,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
break;
}

pysqlite_statement_mark_dirty(self->statement);
stmt_mark_dirty(self->statement);

bind_parameters(state, self->statement, parameters);
if (PyErr_Occurred()) {
Expand Down
5 changes: 0 additions & 5 deletions Modules/_sqlite/statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
return NULL;
}

void pysqlite_statement_mark_dirty(pysqlite_Statement* self)
{
self->in_use = 1;
}

static void
stmt_dealloc(pysqlite_Statement *self)
{
Expand Down
2 changes: 0 additions & 2 deletions Modules/_sqlite/statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ typedef struct

pysqlite_Statement *pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql);

void pysqlite_statement_mark_dirty(pysqlite_Statement* self);

int pysqlite_statement_setup_types(PyObject *module);

#endif