diff options
author | Gerhard Häring <gh@ghaering.de> | 2010-03-05 15:50:25 (GMT) |
---|---|---|
committer | Gerhard Häring <gh@ghaering.de> | 2010-03-05 15:50:25 (GMT) |
commit | 924b5711049bb906bfde08ea1fee5118e57280ac (patch) | |
tree | 910c7f84c4e46d2ec6669368afcce17161398b7a /Modules | |
parent | f580a5b9249b9a7983ff9358467479e151e08c05 (diff) | |
download | cpython-924b5711049bb906bfde08ea1fee5118e57280ac.zip cpython-924b5711049bb906bfde08ea1fee5118e57280ac.tar.gz cpython-924b5711049bb906bfde08ea1fee5118e57280ac.tar.bz2 |
Issue #7670: sqlite3: Fixed crashes when operating on closed connections.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_sqlite/connection.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 7417791..309b168 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -765,6 +765,10 @@ PyObject* pysqlite_connection_create_function(pysqlite_Connection* self, PyObjec int narg; int rc; + if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { + return NULL; + } + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "siO", kwlist, &name, &narg, &func)) { @@ -794,6 +798,10 @@ PyObject* pysqlite_connection_create_aggregate(pysqlite_Connection* self, PyObje static char *kwlist[] = { "name", "n_arg", "aggregate_class", NULL }; int rc; + if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { + return NULL; + } + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "siO:create_aggregate", kwlist, &name, &n_arg, &aggregate_class)) { return NULL; @@ -884,6 +892,10 @@ PyObject* pysqlite_connection_set_authorizer(pysqlite_Connection* self, PyObject static char *kwlist[] = { "authorizer_callback", NULL }; int rc; + if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { + return NULL; + } + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:set_authorizer", kwlist, &authorizer_cb)) { return NULL; @@ -909,6 +921,10 @@ PyObject* pysqlite_connection_set_progress_handler(pysqlite_Connection* self, Py static char *kwlist[] = { "progress_handler", "n", NULL }; + if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { + return NULL; + } + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oi:set_progress_handler", kwlist, &progress_handler, &n)) { return NULL; @@ -1020,6 +1036,10 @@ PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, Py PyObject* weakref; int rc; + if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { + return NULL; + } + if (!PyArg_ParseTuple(args, "O", &sql)) { return NULL; } |