Kaydet (Commit) 5170c16d authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka

Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation()

if pass invalid string-like object as a name.  Original patch by Xiang Zhang.
üst dace77c5
......@@ -44,6 +44,9 @@ Core and Builtins
Library
-------
- Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation()
if pass invalid string-like object as a name. Original patch by Xiang Zhang.
- Issue #1703178: Fix the ability to pass the --link-objects option to the
distutils build_ext command.
......
......@@ -1476,16 +1476,18 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
goto finally;
}
if (!PyArg_ParseTuple(args, "O!O:create_collation(name, callback)", &PyString_Type, &name, &callable)) {
if (!PyArg_ParseTuple(args, "SO:create_collation(name, callback)",
&name, &callable)) {
goto finally;
}
uppercase_name = PyObject_CallMethod(name, "upper", "");
uppercase_name = PyObject_CallMethod((PyObject *)&PyString_Type,
"upper", "O", name);
if (!uppercase_name) {
goto finally;
}
chk = PyString_AsString(uppercase_name);
chk = PyString_AS_STRING(uppercase_name);
while (*chk) {
if ((*chk >= '0' && *chk <= '9')
|| (*chk >= 'A' && *chk <= 'Z')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment