mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation()
if pass invalid string-like object as a name. Patch by Xiang Zhang.
This commit is contained in:
parent
a24d2d8274
commit
407ac47690
3 changed files with 29 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue