mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
SF bug #1004088: big code objects (>64K) may be optimized incorrectly
Will backport.
This commit is contained in:
parent
ba59be04fa
commit
98bd1814e2
1 changed files with 5 additions and 0 deletions
|
|
@ -379,6 +379,11 @@ optimize_code(PyObject *code, PyObject* consts, PyObject *names)
|
||||||
if (codestr == NULL)
|
if (codestr == NULL)
|
||||||
goto exitUnchanged;
|
goto exitUnchanged;
|
||||||
codestr = memcpy(codestr, PyString_AS_STRING(code), codelen);
|
codestr = memcpy(codestr, PyString_AS_STRING(code), codelen);
|
||||||
|
|
||||||
|
/* Avoid situations where jump retargeting could overflow */
|
||||||
|
if (codelen > 65000)
|
||||||
|
goto exitUnchanged;
|
||||||
|
|
||||||
blocks = markblocks(codestr, codelen);
|
blocks = markblocks(codestr, codelen);
|
||||||
if (blocks == NULL) {
|
if (blocks == NULL) {
|
||||||
PyMem_Free(codestr);
|
PyMem_Free(codestr);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue