-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-111178: fix UBSan failures in Modules/_ssl.c
#130719
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
Changes from 8 commits
801a41c
e1c5020
e101a98
d734c1e
fe9f918
9a88242
58d5d42
62cfada
dc0a521
9a4079c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,13 +153,13 @@ _x509name_print(_sslmodulestate *state, X509_NAME *name, int indent, unsigned lo | |
* PySSLCertificate_Type | ||
*/ | ||
|
||
#define _PySSLCertificate_CAST(op) ((PySSLCertificate *)(op)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't thinkt that this change is useful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I myself did the change and I at that time put an underscore. But considering I used the convention "objectname+_CAST" for the series of PR and that I amended some changes I've done recently I think we can refactor this one as well (if the code is however not by me and/or is older, I can revert that change) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: it's something I've changed last month, and I thought I fixed all the UBSan issues in the SSL module but this wasn't the case. I can revert it if you don't want this additional diff. |
||
#define PySSLCertificate_CAST(op) ((PySSLCertificate *)(op)) | ||
|
||
static PyObject * | ||
certificate_repr(PyObject *op) | ||
{ | ||
PyObject *osubject, *result; | ||
PySSLCertificate *self = _PySSLCertificate_CAST(op); | ||
PySSLCertificate *self = PySSLCertificate_CAST(op); | ||
|
||
/* subject string is ASCII encoded, UTF-8 chars are quoted */ | ||
osubject = _x509name_print( | ||
|
@@ -181,7 +181,7 @@ certificate_repr(PyObject *op) | |
static Py_hash_t | ||
certificate_hash(PyObject *op) | ||
{ | ||
PySSLCertificate *self = _PySSLCertificate_CAST(op); | ||
PySSLCertificate *self = PySSLCertificate_CAST(op); | ||
if (self->hash == (Py_hash_t)-1) { | ||
unsigned long hash; | ||
hash = X509_subject_name_hash(self->cert); | ||
|
@@ -198,7 +198,7 @@ static PyObject * | |
certificate_richcompare(PyObject *lhs, PyObject *rhs, int op) | ||
{ | ||
int cmp; | ||
PySSLCertificate *self = _PySSLCertificate_CAST(lhs); | ||
PySSLCertificate *self = PySSLCertificate_CAST(lhs); | ||
_sslmodulestate *state = get_state_cert(self); | ||
|
||
if (Py_TYPE(rhs) != state->PySSLCertificate_Type) { | ||
|
@@ -219,7 +219,7 @@ certificate_richcompare(PyObject *lhs, PyObject *rhs, int op) | |
static void | ||
certificate_dealloc(PyObject *op) | ||
{ | ||
PySSLCertificate *self = _PySSLCertificate_CAST(op); | ||
PySSLCertificate *self = PySSLCertificate_CAST(op); | ||
PyTypeObject *tp = Py_TYPE(self); | ||
X509_free(self->cert); | ||
(void)Py_TYPE(self)->tp_free(self); | ||
|
Uh oh!
There was an error while loading. Please reload this page.