◐ Shell
clean mode source ↗

gh-111178: fix UBSan failures in `Modules/_zoneinfo.c` by picnixz · Pull Request #129798 · python/cpython

Conversation

@picnixz

@picnixz picnixz commented

Feb 7, 2025

edited by bedevere-app Bot

Loading

@picnixz picnixz marked this pull request as ready for review

February 7, 2025 18:19

@picnixz

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 ready for review

February 8, 2025 09:27

encukou

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)

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.

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.

Raw casts were restored when they could be left as is

@encukou

@picnixz picnixz deleted the fix/ubsan/zoneinfo-111178 branch

February 28, 2025 13:11

Labels

2 participants

@picnixz @encukou