From: Raymond Hettinger Date: Fri, 6 Aug 2004 19:46:34 +0000 (+0000) Subject: SF bug #1004088: big code objects (>64K) may be optimized incorrectly X-Git-Tag: v2.4a3~394 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98bd1814e24434ca9961dddc71bf21db67211ab9;p=python SF bug #1004088: big code objects (>64K) may be optimized incorrectly Will backport. --- diff --git a/Python/compile.c b/Python/compile.c index 0b5ba6cd38..5c67987a9a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -379,6 +379,11 @@ optimize_code(PyObject *code, PyObject* consts, PyObject *names) 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);