summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite
diff options
context:
space:
mode:
authorGerhard Häring <gh@ghaering.de>2010-03-05 15:55:55 (GMT)
committerGerhard Häring <gh@ghaering.de>2010-03-05 15:55:55 (GMT)
commit7857650833b68664f879edfc33bf8dc183bbc4a2 (patch)
tree276ef452e337fceee85cc854a2e0cfbac61b2307 /Modules/_sqlite
parent9482032761244da95a14f917b92ce068139b0779 (diff)
downloadcpython-7857650833b68664f879edfc33bf8dc183bbc4a2.zip
cpython-7857650833b68664f879edfc33bf8dc183bbc4a2.tar.gz
cpython-7857650833b68664f879edfc33bf8dc183bbc4a2.tar.bz2
Issue #7670: sqlite3: Fixed crashes when operating on closed connections.
Diffstat (limited to 'Modules/_sqlite')
-rw-r--r--Modules/_sqlite/connection.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index a3170f3..b08b07d 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -690,6 +690,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))
{
@@ -719,6 +723,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;
@@ -809,6 +817,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;
@@ -834,6 +846,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;
@@ -948,6 +964,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;
}