]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-35193: Fix an off by one error in the RETURN_VALUE case. (GH-10418)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 9 Nov 2018 02:13:14 +0000 (18:13 -0800)
committerGitHub <noreply@github.com>
Fri, 9 Nov 2018 02:13:14 +0000 (18:13 -0800)
commitf16ebcd460aaeb8d6b31db317d22f5ed68afbcc8
treee8db15abb76f52643be4fab999bbfebea6bb3b82
parent732f745a4a2d99319a5297552cf4883d8d9c3656
bpo-35193: Fix an off by one error in the RETURN_VALUE case. (GH-10418)

Fix an off by one error in the peephole optimizer when checking for unreachable code beyond a return.

Do a bounds check within find_op so it can return before going past the end as a safety measure.

https://github.com/python/cpython/commit/7db3c488335168993689ddae5914a28e16188447GH-diff-a33329ae6ae0bb295d742f0caf93c137
introduced this off by one error while fixing another one nearby.

This bug was shipped in all Python 3.6 and 3.7 releases.

The included unittest won't fail unless you do a clang msan build.
(cherry picked from commit 49fa4a9f1ef387e16596f271414c855339eadf09)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Lib/test/test_compile.py
Misc/NEWS.d/next/Core and Builtins/2018-11-08-15-00-58.bpo-35193.HzPS6R.rst [new file with mode: 0644]
Python/peephole.c