]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-35193: Fix an off by one error in the RETURN_VALUE case. (GH-10418)
authorGregory P. Smith <greg@krypto.org>
Fri, 9 Nov 2018 01:55:07 +0000 (17:55 -0800)
committerGitHub <noreply@github.com>
Fri, 9 Nov 2018 01:55:07 +0000 (17:55 -0800)
commit49fa4a9f1ef387e16596f271414c855339eadf09
tree87c3064e9afd4029016660e977d4cccf9c4d4f70
parentfd512d76456b65c529a5bc58d8cfe73e4a10de7a
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/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.
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