[Python-checkins] python/dist/src/Python marshal.c,1.83,1.84

mwh@users.sourceforge.net mwh at users.sourceforge.net
Fri Jun 3 17:17:19 CEST 2005


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29871

Modified Files:
	marshal.c 
Log Message:
Fix a couple of crashing-on-malformed data marshal bugs.


Index: marshal.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- marshal.c	3 Jun 2005 14:41:54 -0000	1.83
+++ marshal.c	3 Jun 2005 15:17:16 -0000	1.84
@@ -632,13 +632,13 @@
 			return NULL;
 		}
 		v = PyString_FromStringAndSize((char *)NULL, n);
-		if (v != NULL) {
-			if (r_string(PyString_AS_STRING(v), (int)n, p) != n) {
-				Py_DECREF(v);
-				v = NULL;
-				PyErr_SetString(PyExc_EOFError,
+		if (v == NULL)
+			return v;
+		if (r_string(PyString_AS_STRING(v), (int)n, p) != n) {
+			Py_DECREF(v);
+			PyErr_SetString(PyExc_EOFError,
 					"EOF read where object expected");
-			}
+			return NULL;
 		}
 		if (type == TYPE_INTERNED) {
 			PyString_InternInPlace(&v);
@@ -766,6 +766,8 @@
 			}
 			PyTuple_SET_ITEM(v, (int)i, v2);
 		}
+		if (v == NULL)
+			return v;
 		if (type == TYPE_SET)
 			v3 = PyObject_CallFunctionObjArgs(
 				(PyObject *)&PySet_Type, v, NULL);



More information about the Python-checkins mailing list