[Python-checkins] python/dist/src/Python marshal.c,1.85,1.86

mwh@users.sourceforge.net mwh at users.sourceforge.net
Mon Jun 13 20:28:48 CEST 2005


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

Modified Files:
	marshal.c 
Log Message:
Fix bug

[ 1180997 ] lax error-checking in new-in-2.4 marshal stuff

which I'd assigned to Martin, but actually turned out to be easy to fix.

Also, a test.



Index: marshal.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- marshal.c	13 Jun 2005 17:50:18 -0000	1.85
+++ marshal.c	13 Jun 2005 18:28:46 -0000	1.86
@@ -648,6 +648,10 @@
 
 	case TYPE_STRINGREF:
 		n = r_long(p);
+		if (n < 0 || n >= PyList_GET_SIZE(p->strings)) {
+			PyErr_SetString(PyExc_ValueError, "bad marshal data");
+			return NULL;
+		}
 		v = PyList_GET_ITEM(p->strings, n);
 		Py_INCREF(v);
 		return v;



More information about the Python-checkins mailing list