Following the upgrade to iCalendar 7.x, the add_missing_timezones method now prepends timezone data to the beginning of the .ics file (see collective/icalendar#844).
When this leading VTIMEZONE block exceeds approximately 200 lines, Google Calendar fails to parse the file correctly. This results in Chinese characters rendering as gibberish or the calendar throwing an "unable to process" error. This behavior suggests a potential buffer overflow or character encoding handling issue in Google’s ICS parser when processing large headers.
Import the following ics file into Google Calendar (This causes only gibberish Chinese characters)
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Test//EN
BEGIN:VTIMEZONE
TZID:Europe/Zagreb
COMMENT:This timezone only works from 1970-01-01 to 2038-01-01.
BEGIN:STANDARD
DTSTART:19700101T000000
TZNAME:CET
TZOFFSETFROM:+0100
TZOFFSETTO:+0100
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:19830327T030000
RDATE:19840325T030000,19850331T030000,19860330T030000,19870329T030000,1988
0327T030000,19890326T030000,19900325T030000,19910331T030000,19920329T03000
0,19930328T030000,19940327T030000,19950326T030000,19960331T030000,19970330
T030000,19980329T030000,19990328T030000,20000326T030000,20010325T030000,20
020331T030000,20030330T030000,20040328T030000,20050327T030000,20060326T030
000,20070325T030000,20080330T030000,20090329T030000,20100328T030000,201103
27T030000,20120325T030000,20130331T030000,20140330T030000,20150329T030000,
20160327T030000,20170326T030000,20180325T030000,20190331T030000,20200329T0
30000,20210328T030000,20220327T030000,20230326T030000,20240331T030000,2025
0330T030000,20260329T030000,20270328T030000,20280326T030000,20290325T03000
0,20300331T030000,20310330T030000,20320328T030000,20330327T030000,20340326
T030000,20350325T030000,20360330T030000,20370329T030000
TZNAME:CEST
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:19830925T030000
RDATE:19840930T030000,19850929T030000,19860928T030000,19870927T030000,1988
0925T030000,19890924T030000,19900930T030000,19910929T030000,19920927T03000
0,19930926T030000,19940925T030000,19950924T030000,19961027T030000,19971026
T030000,19981025T030000,19991031T030000,20001029T030000,20011028T030000,20
021027T030000,20031026T030000,20041031T030000,20051030T030000,20061029T030
000,20071028T030000,20081026T030000,20091025T030000,20101031T030000,201110
30T030000,20121028T030000,20131027T030000,20141026T030000,20151025T030000,
20161030T030000,20171029T030000,20181028T030000,20191027T030000,20201025T0
30000,20211031T030000,20221030T030000,20231029T030000,20241027T030000,2025
1026T030000,20261025T030000,20271031T030000,20281029T030000,20291028T03000
0,20301027T030000,20311026T030000,20321031T030000,20331030T030000,20341029
T030000,20351028T030000,20361026T030000,20371025T030000
TZNAME:CET
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
END:STANDARD
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:Europe/Zagreb
COMMENT:This timezone only works from 1970-01-01 to 2038-01-01.
BEGIN:STANDARD
DTSTART:19700101T000000
TZNAME:CET
TZOFFSETFROM:+0100
TZOFFSETTO:+0100
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:19830327T030000
RDATE:19840325T030000,19850331T030000,19860330T030000,19870329T030000,1988
0327T030000,19890326T030000,19900325T030000,19910331T030000,19920329T03000
0,19930328T030000,19940327T030000,19950326T030000,19960331T030000,19970330
T030000,19980329T030000,19990328T030000,20000326T030000,20010325T030000,20
020331T030000,20030330T030000,20040328T030000,20050327T030000,20060326T030
000,20070325T030000,20080330T030000,20090329T030000,20100328T030000,201103
27T030000,20120325T030000,20130331T030000,20140330T030000,20150329T030000,
20160327T030000,20170326T030000,20180325T030000,20190331T030000,20200329T0
30000,20210328T030000,20220327T030000,20230326T030000,20240331T030000,2025
0330T030000,20260329T030000,20270328T030000,20280326T030000,20290325T03000
0,20300331T030000,20310330T030000,20320328T030000,20330327T030000,20340326
T030000,20350325T030000,20360330T030000,20370329T030000
TZNAME:CEST
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:19830925T030000
RDATE:19840930T030000,19850929T030000,19860928T030000,19870927T030000,1988
0925T030000,19890924T030000,19900930T030000,19910929T030000,19920927T03000
0,19930926T030000,19940925T030000,19950924T030000,19961027T030000,19971026
T030000,19981025T030000,19991031T030000,20001029T030000,20011028T030000,20
021027T030000,20031026T030000,20041031T030000,20051030T030000,20061029T030
000,20071028T030000,20081026T030000,20091025T030000,20101031T030000,201110
30T030000,20121028T030000,20131027T030000,20141026T030000,20151025T030000,
20161030T030000,20171029T030000,20181028T030000,20191027T030000,20201025T0
30000,20211031T030000,20221030T030000,20231029T030000,20241027T030000,2025
1026T030000,20261025T030000,20271031T030000,20281029T030000,20291028T03000
0,20301027T030000,20311026T030000,20321031T030000,20331030T030000,20341029
T030000,20351028T030000,20361026T030000,20371025T030000
TZNAME:CET
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
END:STANDARD
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:Europe/Zagreb
COMMENT:This timezone only works from 1970-01-01 to 2038-01-01.
BEGIN:STANDARD
DTSTART:19700101T000000
TZNAME:CET
TZOFFSETFROM:+0100
TZOFFSETTO:+0100
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:19830327T030000
RDATE:19840325T030000,19850331T030000,19860330T030000,19870329T030000,1988
0327T030000,19890326T030000,19900325T030000,19910331T030000,19920329T03000
0,19930328T030000,19940327T030000,19950326T030000,19960331T030000,19970330
T030000,19980329T030000,19990328T030000,20000326T030000,20010325T030000,20
020331T030000,20030330T030000,20040328T030000,20050327T030000,20060326T030
000,20070325T030000,20080330T030000,20090329T030000,20100328T030000,201103
27T030000,20120325T030000,20130331T030000,20140330T030000,20150329T030000,
20160327T030000,20170326T030000,20180325T030000,20190331T030000,20200329T0
30000,20210328T030000,20220327T030000,20230326T030000,20240331T030000,2025
0330T030000,20260329T030000,20270328T030000,20280326T030000,20290325T03000
0,20300331T030000,20310330T030000,20320328T030000,20330327T030000,20340326
T030000,20350325T030000,20360330T030000,20370329T030000
TZNAME:CEST
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:19830925T030000
RDATE:19840930T030000,19850929T030000,19860928T030000,19870927T030000,1988
0925T030000,19890924T030000,19900930T030000,19910929T030000,19920927T03000
0,19930926T030000,19940925T030000,19950924T030000,19961027T030000,19971026
T030000,19981025T030000,19991031T030000,20001029T030000,20011028T030000,20
021027T030000,20031026T030000,20041031T030000,20051030T030000,20061029T030
000,20071028T030000,20081026T030000,20091025T030000,20101031T030000,201110
30T030000,20121028T030000,20131027T030000,20141026T030000,20151025T030000,
20161030T030000,20171029T030000,20181028T030000,20191027T030000,20201025T0
30000,20211031T030000,20221030T030000,20231029T030000,20241027T030000,2025
1026T030000,20261025T030000,20271031T030000,20281029T030000,20291028T03000
0,20301027T030000,20311026T030000,20321031T030000,20331030T030000,20341029
T030000,20351028T030000,20361026T030000,20371025T030000
TZNAME:CET
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
END:STANDARD
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:Europe/Zagreb
COMMENT:This timezone only works from 1970-01-01 to 2038-01-01.
BEGIN:STANDARD
DTSTART:19700101T000000
TZNAME:CET
TZOFFSETFROM:+0100
TZOFFSETTO:+0100
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:19830327T030000
RDATE:19840325T030000,19850331T030000,19860330T030000,19870329T030000,1988
0327T030000,19890326T030000,19900325T030000,19910331T030000,19920329T03000
0,19930328T030000,19940327T030000,19950326T030000,19960331T030000,19970330
T030000,19980329T030000,19990328T030000,20000326T030000,20010325T030000,20
020331T030000,20030330T030000,20040328T030000,20050327T030000,20060326T030
000,20070325T030000,20080330T030000,20090329T030000,20100328T030000,201103
27T030000,20120325T030000,20130331T030000,20140330T030000,20150329T030000,
20160327T030000,20170326T030000,20180325T030000,20190331T030000,20200329T0
30000,20210328T030000,20220327T030000,20230326T030000,20240331T030000,2025
0330T030000,20260329T030000,20270328T030000,20280326T030000,20290325T03000
0,20300331T030000,20310330T030000,20320328T030000,20330327T030000,20340326
T030000,20350325T030000,20360330T030000,20370329T030000
TZNAME:CEST
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:19830925T030000
RDATE:19840930T030000,19850929T030000,19860928T030000,19870927T030000,1988
0925T030000,19890924T030000,19900930T030000,19910929T030000,19920927T03000
0,19930926T030000,19940925T030000,19950924T030000,19961027T030000,19971026
T030000,19981025T030000,19991031T030000,20001029T030000,20011028T030000,20
021027T030000,20031026T030000,20041031T030000,20051030T030000,20061029T030
000,20071028T030000,20081026T030000,20091025T030000,20101031T030000,201110
30T030000,20121028T030000,20131027T030000,20141026T030000,20151025T030000,
20161030T030000,20171029T030000,20181028T030000,20191027T030000,20201025T0
30000,20211031T030000,20221030T030000,20231029T030000,20241027T030000,2025
1026T030000,20261025T030000,20271031T030000,20281029T030000,20291028T03000
0,20301027T030000,20311026T030000,20321031T030000,20331030T030000,20341029
T030000,20351028T030000,20361026T030000,20371025T030000
TZNAME:CET
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
SUMMARY:中文標題測試
DTSTART;TZID=Asia/Taipei:20260326T164235
DTEND;TZID=Asia/Taipei:20260326T174235
DESCRIPTION:測試事件
END:VEVENT
END:VCALENDAR
Describe the bug
Following the upgrade to iCalendar 7.x, the add_missing_timezones method now prepends timezone data to the beginning of the .ics file (see collective/icalendar#844).
When this leading VTIMEZONE block exceeds approximately 200 lines, Google Calendar fails to parse the file correctly. This results in Chinese characters rendering as gibberish or the calendar throwing an "unable to process" error. This behavior suggests a potential buffer overflow or character encoding handling issue in Google’s ICS parser when processing large headers.
To Reproduce
Import the following ics file into Google Calendar (This causes only gibberish Chinese characters)