fix for part of bug #453523: disable unmarshalling of code objects in
authorMichael W. Hudson <mwh@python.net>
Thu, 30 Aug 2001 14:50:20 +0000 (14:50 +0000)
committerMichael W. Hudson <mwh@python.net>
Thu, 30 Aug 2001 14:50:20 +0000 (14:50 +0000)
restricted execution mode.

Python/marshal.c

index 029f2b996df74634ee7d7914f2c062d7072d6623..944ae35a0c1f4373f0458785d8f1afac58bac0f0 100644 (file)
@@ -569,7 +569,13 @@ r_object(RFILE *p)
                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);