diff Python/marshal.c @ 56344:9130fe9c58bf 2.6

Issue #7019: An attempt to unmarshal bad long data could produce unnormalized PyLong objects; make it raise ValueError instead.
author Mark Dickinson <dickinsm@gmail.com>
date Sat, 03 Oct 2009 08:15:49 +0000
parents f50edd4bb48f
children e38335d4df91
line wrap: on
line diff
--- a/Python/marshal.c	Sat Oct 03 08:02:53 2009 +0000
+++ b/Python/marshal.c	Sat Oct 03 08:15:49 2009 +0000
@@ -589,7 +589,8 @@
 			ob->ob_size = n;
 			for (i = 0; i < size; i++) {
 				int digit = r_short(p);
-				if (digit < 0) {
+				if (digit < 0 ||
+				    (digit == 0 && i == size-1)) {
 					Py_DECREF(ob);
 					PyErr_SetString(PyExc_ValueError,
 							"bad marshal data");