Skip to content
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-41085: Fixed 'array.array.index' downcasting 'Py_ssize_t' to 'long'. #21071

Merged
merged 2 commits into from Jun 23, 2020

Conversation

WildCard65
Copy link
Contributor

@WildCard65 WildCard65 commented Jun 23, 2020

Fix integer overflow in the array.array.index() method on 64-bit Windows for index larger than 2**31.

https://bugs.python.org/issue41085

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a NEWS entry: either run blurb tool locally, or use https://blurb-it.herokuapp.com/ service.

Modules/arraymodule.c Outdated Show resolved Hide resolved
@vstinner
Copy link
Member

The function 'array_array_index' was invoking 'PyLong_FromLong' instead of 'PyLong_FromSsize_t', this was causing the returned index to overflow the signed positive limit, not only that, but on some platforms, 'long' is an alias for 'int'

I suggest to write a more high-level description for end users, like:

"Fix integer overflow in the array.array.index() method on 64-bit Windows for index larger than 2**31."

@@ -0,0 +1 @@
Fixed 'array_array_index' downcasting 'Py_ssize_t' to 'long'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(copy/paste of my comment :-))

I suggest to write a more high-level description for end users, like:

"Fix integer overflow in the array.array.index() method on 64-bit Windows for index larger than 2**31."

@WildCard65
Copy link
Contributor Author

@vstinner There, I made the changes you requested.

@WildCard65 WildCard65 requested a review from vstinner June 23, 2020 12:09
@WildCard65
Copy link
Contributor Author

This pull request may need backporting to older Python versions (Found the issue goes as far back as Python 2.7)

@vstinner vstinner merged commit 1d3dad5 into python:master Jun 23, 2020
@vstinner vstinner added needs backport to 3.8 only security fixes needs backport to 3.9 only security fixes labels Jun 23, 2020
@miss-islington
Copy link
Contributor

Thanks @WildCard65 for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @WildCard65 for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 23, 2020
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows
for index larger than ``2**31``.
(cherry picked from commit 1d3dad5)

Co-authored-by: WildCard65 <WildCard65@users.noreply.github.com>
@bedevere-bot
Copy link

GH-21076 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Jun 23, 2020
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 23, 2020
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows
for index larger than ``2**31``.
(cherry picked from commit 1d3dad5)

Co-authored-by: WildCard65 <WildCard65@users.noreply.github.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label Jun 23, 2020
@bedevere-bot
Copy link

GH-21077 is a backport of this pull request to the 3.8 branch.

@vstinner
Copy link
Member

Thanks @WildCard65, I merged your PR!

This pull request may need backporting to older Python versions (Found the issue goes as far back as Python 2.7)

Right. I created backports to 3.8 and 3.9 branches. I don't think that it's worth it to backport it to 3.7 which is very close to move to security-only. Python 2.7 is no longer maintained.

https://devguide.python.org/#status-of-python-branches

miss-islington added a commit that referenced this pull request Jun 23, 2020
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows
for index larger than ``2**31``.
(cherry picked from commit 1d3dad5)

Co-authored-by: WildCard65 <WildCard65@users.noreply.github.com>
miss-islington added a commit that referenced this pull request Jun 23, 2020
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows
for index larger than ``2**31``.
(cherry picked from commit 1d3dad5)

Co-authored-by: WildCard65 <WildCard65@users.noreply.github.com>
@WildCard65 WildCard65 deleted the bpo-41085 branch June 23, 2020 13:48
fasih pushed a commit to fasih/cpython that referenced this pull request Jun 29, 2020
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows
for index larger than ``2**31``.
arun-mani-j pushed a commit to arun-mani-j/cpython that referenced this pull request Jul 21, 2020
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows
for index larger than ``2**31``.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants