-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-35623: Fix integer overflow when sorting large lists #11380
Conversation
There is already a `Py_ssize_t i` defined at function scope that is used for similar loops. By removing the local `int i` declaration that `i` is used, which has the appropriate type.
Misc/NEWS.d/next/Core and Builtins/2018-12-31-02-37-20.bpo-35623.24AQhY.rst
Outdated
Show resolved
Hide resolved
Co-Authored-By: sth <sth.dev@tejp.de>
It's always nice when you can fix overflows by deleting a line. Thanks! |
Thanks @sth for the PR, and @benjaminp for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6, 3.7. |
GH-11401 is a backport of this pull request to the 3.7 branch. |
…onGH-11380) There is already a `Py_ssize_t i` defined at function scope that is used for similar loops. By removing the local `int i` declaration that `i` is used, which has the appropriate type. (cherry picked from commit f8b5344) Co-authored-by: sth <sth.dev@tejp.de>
Sorry, @sth and @benjaminp, I could not cleanly backport this to |
Sorry, @sth and @benjaminp, I could not cleanly backport this to |
In
list_sort_impl()
in one case anint i
is used to track the number of elements while sorting. With a large list this can lead to an integer overflow. This happens when runningtest_bigmem
with enough memory.There is already a
Py_ssize_t i
defined at function scope that is usedfor similar loops. By removing the local
int i
declaration thati
from function scope isused, which has the appropriate type.
https://bugs.python.org/issue35623