Commit 98bd1814 authored by Raymond Hettinger's avatar Raymond Hettinger

SF bug #1004088: big code objects (>64K) may be optimized incorrectly

Will backport.
parent ba59be04
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment