diff Python/compile.c @ 32977:40c3a51cb71c legacy-trunk

SF bug #1004088: big code objects (>64K) may be optimized incorrectly Will backport.
author Raymond Hettinger <python@rcn.com>
date Fri, 06 Aug 2004 19:46:34 +0000
parents 071d3381753b
children 356887410bde
line wrap: on
line diff
--- a/Python/compile.c	Fri Aug 06 18:55:48 2004 +0000
+++ b/Python/compile.c	Fri Aug 06 19:46:34 2004 +0000
@@ -379,6 +379,11 @@
 	if (codestr == NULL)
 		goto exitUnchanged;
 	codestr = memcpy(codestr, PyString_AS_STRING(code), codelen);
+
+	/* Avoid situations where jump retargeting could overflow */
+	if (codelen > 65000)
+		goto exitUnchanged;
+
 	blocks = markblocks(codestr, codelen);
 	if (blocks == NULL) {
 		PyMem_Free(codestr);