diff options
| author | Raymond Hettinger <python@rcn.com> | 2004-08-06 21:29:22 (GMT) |
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2004-08-06 21:29:22 (GMT) |
| commit | df5b358af6e12b68f1fd38524b8056ff1d49b4b9 (patch) | |
| tree | 94c8cd0c49d419966a7ad16d100adf3aae70bead /Python | |
| parent | 0a49cf469991d9e5fcebe2116fda07b7b9704fca (diff) | |
| download | cpython-df5b358af6e12b68f1fd38524b8056ff1d49b4b9.zip cpython-df5b358af6e12b68f1fd38524b8056ff1d49b4b9.tar.gz cpython-df5b358af6e12b68f1fd38524b8056ff1d49b4b9.tar.bz2 | |
Backport SF bug #1004088:
big code objects (>64K) may be optimized incorrectly
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/compile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c index f2e04b0..21cea42 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<codelen-7 ; i += HAS_ARG(codestr[i]) ? 3 : 1) { opcode = codestr[i]; switch (opcode) { |
