]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-35193: Fix an off by one error in the RETURN_VALUE case. (GH-10418) (GH-10422)
authorGregory P. Smith <greg@krypto.org>
Fri, 9 Nov 2018 07:30:36 +0000 (23:30 -0800)
committerGitHub <noreply@github.com>
Fri, 9 Nov 2018 07:30:36 +0000 (23:30 -0800)
commit65e1a1fd311943866361fcb288c0df65dadbe092
tree89bf7c842b2363d44a04dec1cb507f77429e53f8
parent11a33e171b89ea9267672b0664d739ca06e459ca
bpo-35193: Fix an off by one error in the RETURN_VALUE case. (GH-10418) (GH-10422)

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/7db3c488335168993689ddae5914a28e16188447#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)
Lib/test/test_compile.py
Misc/NEWS.d/next/Core and Builtins/2018-11-08-23-00-04.bpo-35193.WK2PDg.rst [new file with mode: 0644]
Python/peephole.c