Skip to content

gh-111178: fix UBSan failures in Modules/_ssl/cert.c - #129088

Merged
encukou merged 1 commit into
python:mainfrom
picnixz:fix/ubsan/ssl-111178
Jan 30, 2025
Merged

gh-111178: fix UBSan failures in Modules/_ssl/cert.c#129088
encukou merged 1 commit into
python:mainfrom
picnixz:fix/ubsan/ssl-111178

Conversation

@picnixz

@picnixzpicnixz commented Jan 20, 2025

Copy link
Copy Markdown
Member

Comment threadModules/_ssl/cert.c
Py_RETURN_NOTIMPLEMENTED;
}
cmp = X509_cmp(self->cert, ((PySSLCertificate*)other)->cert);
cmp = X509_cmp(self->cert, ((PySSLCertificate*)rhs)->cert);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cmp=X509_cmp(self->cert, ((PySSLCertificate*)rhs)->cert);
cmp=X509_cmp(self->cert, _PySSLCertificate_CAST(rhs)->cert);

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left out fast casts for which the input has already been checked so that if the macro is one day converted to a function with explicit checks, we don't double checks those

@encukou
encukou merged commit 9bc8c5f into python:mainJan 30, 2025
@picnixz
picnixz deleted the fix/ubsan/ssl-111178 branch February 2, 2025 21:51
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Feb 7, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@picnixz@encukou