Skip to content

gh-111178: fix UBSan failures in Modules/_zoneinfo.c #129798

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

Merged
merged 7 commits into from
Feb 26, 2025

Conversation

picnixz
Copy link
Member

@picnixz picnixz commented Feb 7, 2025

This PR fixes the UBSan failures and addresses some minor cosmetic changes. PEP-7 changes were not applied since they could scramble the diff but other semantic changes affecting the signature of touched functions may have been done.

@picnixz
Copy link
Member Author

picnixz commented Feb 7, 2025

Ah I'm sorry I put this one as ready for review but I learned that _ + capital letter was also UB (#128248 (comment)) so I'll fix them tomorrow.

@picnixz picnixz marked this pull request as draft February 7, 2025 18:34
@picnixz picnixz marked this pull request as ready for review February 8, 2025 09:27
Comment on lines 59 to 60
#define PyZoneInfo_ZoneInfo_FAST_CAST(op) ((PyZoneInfo_ZoneInfo *)(op))
#define PyZoneInfo_ZoneInfo_CAST(op) PyZoneInfo_ZoneInfo_FAST_CAST(op)
Copy link
Member

Choose a reason for hiding this comment

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

This deserves a comment.
Or replacing FAST_CAST uses with direct casts.

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the fast cast macro but added a message in my commit saying that that raw casts don't need something else. I think I've only had fast cast macros when I was writing the date/time/tkinter PRs but I may have introduced that in other PR.

@encukou encukou merged commit 18bc5b7 into python:main Feb 26, 2025
41 checks passed
@encukou
Copy link
Member

encukou commented Feb 26, 2025

Thank you!

@picnixz picnixz deleted the fix/ubsan/zoneinfo-111178 branch February 28, 2025 13:11
seehwan pushed a commit to seehwan/cpython that referenced this pull request Apr 16, 2025
…H-129798)

Fix UBSan failures for `PyZoneInfo_ZoneInfo`

Fix semantic naming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants