diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-03-09 18:49:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 18:49:52 (GMT) |
commit | eebaa9bfc593d5a46b293c1abd929fbfbfd28199 (patch) | |
tree | 9ba0bbaba8116eb71d0b80f11b586fe063aadbe5 /Python/peephole.c | |
parent | 6d0ee60740f2862a878f009671b1aaa75aeb0c2a (diff) | |
download | cpython-eebaa9bfc593d5a46b293c1abd929fbfbfd28199.zip cpython-eebaa9bfc593d5a46b293c1abd929fbfbfd28199.tar.gz cpython-eebaa9bfc593d5a46b293c1abd929fbfbfd28199.tar.bz2 |
bpo-38249: Expand Py_UNREACHABLE() to __builtin_unreachable() in the release mode. (GH-16329)
Co-authored-by: Victor Stinner <vstinner@python.org>
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 baa217a..84de1ab 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; } |