-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-100795: avoid unexpected freeaddrinfo
after failed getaddrinfo
#101220
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
Conversation
fixes segfault pythongh-100795 - avoid unexpected `freeaddrinfo` if `res` becomes not NULL during invocation of `getaddrinfo` if it fails
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
I'll propose the news entry as a PR in your repo after https://github.com/sebres/cpython/tree/fix-gh-100795 gets cloned to my computer so I could branch off it. |
Thx!
Why? Can't you push directly to my branch?
(since the branch is obviously not protected and it is under PR, GH'd allow to write there, at least python's members should have write rights). But do what you consider to be right. Thanks again. |
Only members of https://github.com/python can push to branches bound to PRs in https://github.com/python/cpython. I'm not a member, just a regular contributor. |
Misc/NEWS.d/next/Library/2023-01-21-16-50-22.gh-issue-100795.NPMZf7.rst
Outdated
Show resolved
Hide resolved
…PMZf7.rst Co-authored-by: Oleg Iarygin <[email protected]>
Thanks @sebres for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
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'm unsure that this PR is good, see my comment on the issue.
GH-101236 is a backport of this pull request to the 3.11 branch. |
GH-101237 is a backport of this pull request to the 3.10 branch. |
…rinfo` (pythonGH-101220) (cherry picked from commit 5f08fe4) Co-authored-by: Sergey G. Brester <[email protected]> Co-authored-by: Oleg Iarygin <[email protected]>
…rinfo` (pythonGH-101220) (cherry picked from commit 5f08fe4) Co-authored-by: Sergey G. Brester <[email protected]> Co-authored-by: Oleg Iarygin <[email protected]>
Oh sorry, I just merged it. |
I'll revert this, sorry @gpshead. |
… `getaddrinfo` (python#101220)" This reverts commit 5f08fe4.
I'm sure that this PR is good, see my comment on the issue. |
This is rebased #101010 to main.
Proposed PR fixes segfault gh-100795 - avoid unexpected
freeaddrinfo
ifres
becomes not NULL during invocation ofgetaddrinfo
if it fails.Previously this could cause double freeing and other hardly reproducible aftereffects, especially in multithreaded environment.
One could surely do
return -1
instead ofres = NULL
&goto fail
(in second case), like incpython/Modules/socketmodule.c
Line 1095 in 5ef90ee
but this way it is minimal invasive (more consistent, remains safe against some merges or future implementations expecting goto fail to free some other handles, etc).