Skip to content

CFTimeZone: resolve GMT offset names - #136

Open
DTW-Thalion wants to merge 2 commits into
gnustep:masterfrom
DTW-Thalion:fix/cftimezone-gmt-name
Open

CFTimeZone: resolve GMT offset names#136
DTW-Thalion wants to merge 2 commits into
gnustep:masterfrom
DTW-Thalion:fix/cftimezone-gmt-name

Conversation

@DTW-Thalion

Copy link
Copy Markdown
Contributor

CFTimeZoneCreateWithName looked for a zone file for every name, so a GMT offset such as GMT+05:00 or GMT-05:00, which has no file, returned NULL. This is why CFCalendarCopyTimeZone crashed callers for a calendar whose time zone came from a GMT offset: it recreates the zone from the stored name, got NULL back, and an unguarded caller then dereferenced it.

Parse a GMT offset name (GMT followed by a sign and the hours and minutes, with or without a colon) and build the zone from the offset directly, the same way CFTimeZoneCreateWithTimeIntervalFromGMT does. Plain named zones such as GMT and UTC still resolve through their zone files as before.

Tests/CFTimeZone/gmt.m checks the GMT, UTC and GMT-05:00 offsets and the CFCalendarCopyTimeZone round-trip, verified against Apple CoreFoundation.

CFTimeZoneCreateWithName looked for a zone file for every name, so a GMT
offset such as GMT+05:00 (which has no file) returned NULL.  In particular a
calendar whose time zone was created from a GMT offset could not be copied
back, since CFCalendarCopyTimeZone recreates the zone from its name.  Parse a
GMT offset name and build the zone from the offset directly.
@DTW-Thalion
DTW-Thalion force-pushed the fix/cftimezone-gmt-name branch from 5dd4b7f to df61052 Compare July 24, 2026 15:22
@DTW-Thalion DTW-Thalion reopened this Jul 24, 2026
@DTW-Thalion DTW-Thalion reopened this Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant