-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-127667: fix more reference leaks in hashlib
#127668
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
gh-127667: fix more reference leaks in hashlib
#127668
Conversation
I'd prefer if this could be broken in two PRs: one for the refactoring, and one for the error branch fixes. |
Sure! I'll split them into two tomorrow. |
f2a0f6f
to
9e34c0e
Compare
hashlib
error-brancheshashlib
Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
Sorry, @picnixz, I could not cleanly backport this to
|
Sorry, @picnixz, I could not cleanly backport this to
|
Arf, this one won't backport cleanly because it contains some references to the UBSan failures fixes. |
- Correctly handle `NULL` values returned by `EVP_MD_CTX_md`. - Correctly free resources in error branches. - Consistently suppress `_setException()` return value when needed. - Collapse `_setException() + return NULL` into a single statement.
GH-130783 is a backport of this pull request to the 3.12 branch. |
GH-130783 is a backport of this pull request to the 3.12 branch. |
1 similar comment
GH-130783 is a backport of this pull request to the 3.12 branch. |
- Correctly handle `NULL` values returned by `EVP_MD_CTX_md`. - Correctly free resources in error branches. - Consistently suppress `_setException()` return value when needed. - Collapse `_setException() + return NULL` into a single statement.
GH-130784 is a backport of this pull request to the 3.13 branch. |
gh-127667: fix memory leaks in `hashlib` (GH-127668) - Correctly handle `NULL` values returned by `EVP_MD_CTX_md`. - Correctly free resources in error branches. - Consistently suppress `_setException()` return value when needed. - Collapse `_setException() + return NULL` into a single statement. (cherry-picked from commit 0978465)
gh-127667: fix memory leaks in `hashlib` (GH-127668) - Correctly handle `NULL` values returned by `EVP_MD_CTX_md`. - Correctly free resources in error branches. - Consistently suppress `_setException()` return value when needed. - Collapse `_setException() + return NULL` into a single statement. (cherry-picked from commit 0978465)
- Correctly handle `NULL` values returned by `EVP_MD_CTX_md`. - Correctly free resources in error branches. - Consistently suppress `_setException()` return value when needed. - Collapse `_setException() + return NULL` into a single statement.
I took the liberty of changing how exceptions are being set in(this will be in a follow-up PR)hashlib
because_setException(PyExc_ValueError, NULL);
is honestly confusing (namely) that "NULL" stands for a default message when the OpenSSL error message cannot be retrieved).In this PR we:
_setException() + return
into one statement when possible; and_setException()
.hashlib
#127667