summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/compile.c')
-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);