summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-09-26 21:10:03 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-09-26 21:10:03 (GMT)
commit407ac476905a12e80ef4eb511a2d5111dbe62b99 (patch)
tree112dca5ff81d3c2b506f15e32c1d13d420544c50 /Modules
parenta24d2d82746fcdeddd635394b22e5ab480cbad4d (diff)
downloadcpython-407ac476905a12e80ef4eb511a2d5111dbe62b99.zip
cpython-407ac476905a12e80ef4eb511a2d5111dbe62b99.tar.gz
cpython-407ac476905a12e80ef4eb511a2d5111dbe62b99.tar.bz2
Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation()
if pass invalid string-like object as a name. Patch by Xiang Zhang.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_sqlite/connection.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 3c52108..db979f5 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -1523,11 +1523,13 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
goto finally;
}
- if (!PyArg_ParseTuple(args, "O!O:create_collation(name, callback)", &PyUnicode_Type, &name, &callable)) {
+ if (!PyArg_ParseTuple(args, "UO:create_collation(name, callback)",
+ &name, &callable)) {
goto finally;
}
- uppercase_name = _PyObject_CallMethodId(name, &PyId_upper, "");
+ uppercase_name = _PyObject_CallMethodIdObjArgs((PyObject *)&PyUnicode_Type,
+ &PyId_upper, name, NULL);
if (!uppercase_name) {
goto finally;
}