gh-144475: Fix a heap buffer overflow in partial_repr#145362
Open
bkap123 wants to merge 3 commits intopython:mainfrom
Open
gh-144475: Fix a heap buffer overflow in partial_repr#145362bkap123 wants to merge 3 commits intopython:mainfrom
bkap123 wants to merge 3 commits intopython:mainfrom
Conversation
aisk
approved these changes
Feb 28, 2026
Misc/NEWS.d/next/C_API/2026-02-07-16-37-42.gh-issue-144475.8tFEXw.rst
Outdated
Show resolved
Hide resolved
aisk
reviewed
Feb 28, 2026
Member
aisk
left a comment
There was a problem hiding this comment.
Sorry, the approval is by accidant. I don't mean to approve this, just have comments this.
b498bbe to
7b4955f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a cleaner version of PR #144571 (hence the v2 in the title). I am not exactly sure what happened in #144571 so I would appreciate if anyone could tell me so I don't make the same mistake again.
Here are the changes I made:
argsandkwlocal pointer so that both live long enough during the call toreprto prevent a segfaultfnlocal pointer so thatrepruses its original state when generating its final representation.errorgoto and merged it with thedonegoto as I needed to decrement the reference count offn,args, andkw, and I found that decrementing them in thedonegoto was the easiest.fnandkwarguments.