diff options
Diffstat (limited to 'Python/peephole.c')
-rw-r--r-- | Python/peephole.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/peephole.c b/Python/peephole.c index baa217ad02..84de1abc17 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -511,8 +511,12 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, if (instrsize(j) > ilen) { goto exitUnchanged; } - assert(ilen <= INT_MAX); /* If instrsize(j) < ilen, we'll emit EXTENDED_ARG 0 */ + if (ilen > 4) { + /* Can only happen when PyCode_Optimize() is called with + malformed bytecode. */ + goto exitUnchanged; + } write_op_arg(codestr + h, opcode, j, (int)ilen); h += ilen; } |