diff Python/marshal.c @ 19605:10bf4bed5096 legacy-trunk

fix for part of bug #453523: disable unmarshalling of code objects in restricted execution mode.
author Michael W. Hudson <mwh@python.net>
date Thu, 30 Aug 2001 14:50:20 +0000
parents 7e628f60245e
children 65dd6157f999
line wrap: on
line diff
--- a/Python/marshal.c	Thu Aug 30 14:42:40 2001 +0000
+++ b/Python/marshal.c	Thu Aug 30 14:50:20 2001 +0000
@@ -569,7 +569,13 @@
 		return v;
 
 	case TYPE_CODE:
-		{
+		if (PyEval_GetRestricted()) {
+			PyErr_SetString(PyExc_RuntimeError,
+				"cannot unmarshal code objects in "
+				"restricted execution mode");
+			return NULL;
+		}
+		else {
 			int argcount = r_short(p);
 			int nlocals = r_short(p);
 			int stacksize = r_short(p);