diff Python/compile.c @ 32978:678d40fce0b1 2.3

Backport SF bug #1004088: big code objects (>64K) may be optimized incorrectly
author Raymond Hettinger <python@rcn.com>
date Fri, 06 Aug 2004 21:29:22 +0000
parents a7c4aa81eb85
children
line wrap: on
line diff
--- a/Python/compile.c	Tue Aug 03 19:13:18 2004 +0000
+++ b/Python/compile.c	Fri Aug 06 21:29:22 2004 +0000
@@ -345,6 +345,10 @@
 	codestr = memcpy(codestr, PyString_AS_STRING(code), codelen);
 	assert(PyTuple_Check(consts));
 
+	/* Avoid situations where jump retargeting could overflow */
+	if (codelen > 65000)
+		goto exitUnchanged;
+
 	for (i=0 ; i<codelen-7 ; i += HAS_ARG(codestr[i]) ? 3 : 1) {
 		opcode = codestr[i];
 		switch (opcode) {