Issue #7019: An attempt to unmarshal bad long data could produce
unnormalized PyLong objects; make it raise ValueError instead.
diff --git a/Python/marshal.c b/Python/marshal.c
index 52d2257..a4c831f 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -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");