File MySQL-python-1.2.2-ssize.patch of Package python-mysql

--- _mysql.c
+++ _mysql.c
@@ -220,7 +220,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) {
@@ -245,6 +245,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++) {
@@ -270,6 +274,10 @@
 			PyErr_SetString(PyExc_TypeError,
 					"groups could not be sized");
 			goto finish;
+		} else if (groupc > INT_MAX) {
+            PyErr_SetString(PyExc_ValueError,
+                    "more than INT_MAX groups, this is unsupported");
+			goto finish;
 		}
 		groups_c = (char **) PyMem_Malloc((1+groupc)*sizeof(char *));
 		for (i=0; i< groupc; i++) {
@@ -392,7 +400,7 @@
 			Py_INCREF(Py_None);
 		}
 		if (PySequence_Check(fun)) {
-			int j, n2=PySequence_Size(fun);
+			Py_ssize_t j, n2=PySequence_Size(fun);
 			PyObject *fun2=NULL;
 			for (j=0; j<n2; j++) {
 				PyObject *t = PySequence_GetItem(fun, j);
@@ -1086,7 +1094,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)) {
openSUSE Build Service is sponsored by