diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-09-26 21:14:24 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-09-26 21:14:24 (GMT) |
commit | 22805ca54e1e5db4b66be1b28b0baac2b1b4b4de (patch) | |
tree | 58274b5e8f592ebca990e90533e9137b18989989 /Modules/_sqlite | |
parent | de10dbec778b55edae98aaae095188ef1acd6514 (diff) | |
parent | 407ac476905a12e80ef4eb511a2d5111dbe62b99 (diff) | |
download | cpython-22805ca54e1e5db4b66be1b28b0baac2b1b4b4de.zip cpython-22805ca54e1e5db4b66be1b28b0baac2b1b4b4de.tar.gz cpython-22805ca54e1e5db4b66be1b28b0baac2b1b4b4de.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/_sqlite')
-rw-r--r-- | Modules/_sqlite/connection.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index d29fafe..6210227 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -1498,11 +1498,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, NULL); + uppercase_name = _PyObject_CallMethodIdObjArgs((PyObject *)&PyUnicode_Type, + &PyId_upper, name, NULL); if (!uppercase_name) { goto finally; } |