summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-08-06 19:46:34 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-08-06 19:46:34 (GMT)
commit98bd1814e24434ca9961dddc71bf21db67211ab9 (patch)
treea0f4725a89ba27071f3c7c78bcd584854ed9a745
parentba59be04fa172a9104fa5a1ff02f7940ced7c215 (diff)
downloadcpython-98bd1814e24434ca9961dddc71bf21db67211ab9.zip
cpython-98bd1814e24434ca9961dddc71bf21db67211ab9.tar.gz
cpython-98bd1814e24434ca9961dddc71bf21db67211ab9.tar.bz2
SF bug #1004088: big code objects (>64K) may be optimized incorrectly
Will backport.
-rw-r--r--Python/compile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 0b5ba6c..5c67987 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);