-
-
Notifications
You must be signed in to change notification settings - Fork 34k
gh-144475: Fix a heap buffer overflow in partial_repr #144571
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
base: main
Are you sure you want to change the base?
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Please:
|
|
By the way, @dr-carlos already suggested to open a PR. It is polite to ask them if they want to contribute themselves. As such, I'm going to close this one unless they are fine with you making the PR (we don't really want people "sniping" work of others) |
|
Thanks for the feedback. I missed that @dr-carlos suggested to fix it. I’m happy to close this PR if @dr-carlos is already working on it. |
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Hi, thanks for asking! |
|
Here are the changes I made:
|
| Py_DECREF(args); | ||
| Py_DECREF(kw); | ||
| Py_ReprLeave(self); | ||
| return result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this return made sense when the label was 'done'.
Do we still want a side-effect of "return" for a label that "frees arguments"?
Or maybe we keep the "done" label?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not exactly sure. I could see arguments for and against adding a done label before the return.
Personally, I don't think it is necessary, as it would never be used. Since the function returns NULL in the case of an error before a new reference is called to the arguments, adding a done label could be a bit misleading. It might suggest that the done label is called if the function needs to return before the fn, args, and kw point to the arguments, as that is the pattern for the other labels.
I would like to get other people's thoughts on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, since each of the three labels will only be jumped to on an error, a better solution might be to rename each of the labels to the specific error that occurs rather than what gets freed. That way, it makes more sense why the function returns.
e5c7b4e to
a196de4
Compare
Uh oh!
There was an error while loading. Please reload this page.