forked from pool/python-mysqlclient
42 lines
1.4 KiB
Diff
42 lines
1.4 KiB
Diff
|
|
diff -ruN mysqlclient-1.3.13.orig/_mysql.c mysqlclient-1.3.13/_mysql.c
|
||
|
|
--- mysqlclient-1.3.13.orig/_mysql.c 2017-12-21 14:09:51.000000000 +0300
|
||
|
|
+++ mysqlclient-1.3.13/_mysql.c 2018-06-28 01:04:11.433787292 +0300
|
||
|
|
@@ -225,7 +225,7 @@
|
||
|
|
PyObject *kwargs) {
|
||
|
|
static char *kwlist[] = {"args", "groups", NULL};
|
||
|
|
char **cmd_args_c=NULL, **groups_c=NULL, *s;
|
||
|
|
- int cmd_argc=0, i, groupc;
|
||
|
|
+ Py_ssize_t cmd_argc=0, i, groupc;
|
||
|
|
PyObject *cmd_args=NULL, *groups=NULL, *ret=NULL, *item;
|
||
|
|
|
||
|
|
if (_mysql_server_init_done) {
|
||
|
|
@@ -249,6 +249,10 @@
|
||
|
|
PyErr_SetString(PyExc_TypeError,
|
||
|
|
"args could not be sized");
|
||
|
|
goto finish;
|
||
|
|
+ } else if (cmd_argc > INT_MAX) {
|
||
|
|
+ PyErr_SetString(PyExc_ValueError,
|
||
|
|
+ "more than INT_MAX args, this is unsupported");
|
||
|
|
+ goto finish;
|
||
|
|
}
|
||
|
|
cmd_args_c = (char **) PyMem_Malloc(cmd_argc*sizeof(char *));
|
||
|
|
for (i=0; i< cmd_argc; i++) {
|
||
|
|
@@ -415,7 +419,7 @@
|
||
|
|
else if (PySequence_Check(fun)) {
|
||
|
|
long flags = fields[i].flags;
|
||
|
|
PyObject *fun2=NULL;
|
||
|
|
- int j, n2=PySequence_Size(fun);
|
||
|
|
+ Py_ssize_t j, n2=PySequence_Size(fun);
|
||
|
|
if (fields[i].charsetnr != 63) { /* maaagic */
|
||
|
|
flags &= ~BINARY_FLAG;
|
||
|
|
}
|
||
|
|
@@ -1181,7 +1185,7 @@
|
||
|
|
PyObject *args)
|
||
|
|
{
|
||
|
|
PyObject *o=NULL, *d=NULL, *r=NULL, *item, *quoted;
|
||
|
|
- int i, n;
|
||
|
|
+ Py_ssize_t i, n;
|
||
|
|
if (!PyArg_ParseTuple(args, "OO:escape_sequence", &o, &d))
|
||
|
|
goto error;
|
||
|
|
if (!PyMapping_Check(d)) {
|