Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-101037: Fix potential memory underallocation for zeros of int subtypes#101038

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

mdickinson
Copy link
Member

@mdickinsonmdickinson commentedJan 14, 2023
edited by bedevere-bot
Loading

This PR fixes object allocation inlong_subtype_new to ensure that there's at least one digit in all cases, and makes sure that the value of that digit is copied over from the sourcelong.

Needs backport to 3.11, but not any further: the change to require at least one digit was only introduced for Python 3.11.

Fixes#101037.

@mdickinson
Copy link
MemberAuthor

@corona10 Would you be willing to review?

corona10 reacted with thumbs up emoji

@mdickinson
Copy link
MemberAuthor

and makes sure that the value of that digit is copied over from the sourcelong.

Just a comment: this seems fairly harmless in this case, but I'd note that wedon't in general do anything special to make sure thatob_digit[0] contains anything meaningful in the case of zero being represented. (E.g.,_PyLong_Copy won't copy over the zero digit.) I've added a note tolongintrepr.h in this PR to clarify this.

@mdickinsonmdickinson added the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelJan 14, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@mdickinson for commit2ddd5c1 🤖

If you want to schedule another build, you need to add the:hammer: test-with-buildbots label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelJan 14, 2023
@corona10
Copy link
Member

corona10 commentedJan 15, 2023
edited
Loading

@mdickinson I will take a look. Thanks

@corona10
Copy link
Member

For refleak:

➜  cpython git:(pr/101038) ✗ ./python.exe -m test test_capi.test_misc -R 3:3Raised RLIMIT_NOFILE: 256 -> 10240:00:00 load avg: 1.76 Run tests sequentially0:00:00 load avg: 1.76 [1/1] test_capi.test_miscbeginning 6 repetitions123456......test_capi.test_misc leaked [200, 200, 200] references, sum=600test_capi.test_misc failed (reference leak)== Tests result: FAILURE ==1 test failed:    test_capi.test_miscTotal duration: 21.3 secTests result: FAILURE

Copy link
Member

@corona10corona10 left a comment
edited
Loading

Choose a reason for hiding this comment

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

LGTM

The refleak is unrelated to this PR :)
see:#100998 (comment)

@corona10corona10force-pushed thefix-int-subtype-underallocation branch from2ddd5c1 to877067cCompareJanuary 19, 2023 13:51
@corona10corona10 added the 🔨 test-with-refleak-buildbotsTest PR w/ refleak buildbots; report in status section labelJan 20, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@corona10 for commit877067c 🤖

If you want to schedule another build, you need to add the:hammer: test-with-refleak-buildbots label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-refleak-buildbotsTest PR w/ refleak buildbots; report in status section labelJan 20, 2023
@corona10
Copy link
Member

@mdickinson Oops, sorry, I tried to rebase the branch forrefleak test, but it messed up the commit history

@mdickinson
Copy link
MemberAuthor

@corona10 No problem; thanks for reviewing!

corona10 reacted with heart emoji

@mdickinsonmdickinson merged commit401fdf9 intopython:mainJan 21, 2023
@miss-islington
Copy link
Contributor

Thanks@mdickinson for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJan 21, 2023
…t subtypes (pythonGH-101038)This PR fixes object allocation in long_subtype_new to ensure that there's at least one digit in all cases, and makes sure that the value of that digit is copied over from the source long.Needs backport to 3.11, but not any further: the change to require at least one digit was only introduced for Python 3.11.FixespythonGH-101037.(cherry picked from commit401fdf9)Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
@bedevere-bot
Copy link

GH-101219 is a backport of this pull request to the3.11 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.11only security fixes labelJan 21, 2023
@mdickinsonmdickinson deleted the fix-int-subtype-underallocation branchJanuary 21, 2023 10:24
mdickinson added a commit that referenced this pull requestJan 21, 2023
…nt subtypes (GH-101038) (#101219)gh-101037: Fix potential memory underallocation for zeros of int subtypes (GH-101038)This PR fixes object allocation in long_subtype_new to ensure that there's at least one digit in all cases, and makes sure that the value of that digit is copied over from the source long.Needs backport to 3.11, but not any further: the change to require at least one digit was only introduced for Python 3.11.FixesGH-101037.(cherry picked from commit401fdf9)Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@corona10corona10corona10 approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

long_subtype_new underallocates for zero
4 participants
@mdickinson@bedevere-bot@corona10@miss-islington

[8]ページ先頭

©2009-2025 Movatter.jp