From df5b358af6e12b68f1fd38524b8056ff1d49b4b9 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Fri, 6 Aug 2004 21:29:22 +0000 Subject: [PATCH] Backport SF bug #1004088: big code objects (>64K) may be optimized incorrectly --- Python/compile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Python/compile.c b/Python/compile.c index f2e04b00c1b0..21cea42f7ef5 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -345,6 +345,10 @@ optimize_code(PyObject *code, PyObject* consts) 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