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

--- _mysql.c
+++ _mysql.c
@@ -264,7 +264,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) {
@@ -289,6 +289,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++) {
@@ -319,6 +323,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++) {
@@ -467,7 +475,7 @@
 			Py_INCREF(Py_None);
 		}
 		else 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);
@@ -1241,7 +1249,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