Open georgehrke opened 7 years ago
@mschroeder @kewisch I'd be happy to send a pull-request to fix this. Any pointers how to debug this?
Thanks for the offer! First of all I would try to minimize the ics in the testcase to see if it is something about the VEVENT or the VTIMEZONE. Timezone calculation is also done with help of the recurrence parser. From there, you can drill down into RecurExpansion, my guess would be that it is the recurrence iterator code instead.
@Decathlon1578 might also have some ideas here, as he had fixed some recurrence parser issues in the past.
today i run into the same issue, as a dirty hack i added a check for years > 2100 in recur_iterator.js
to stop the yearly loop
if (this.rule.freq == "YEARLY") {
for (;;) {
this.expand_year_days(this.last.year);
if (this.days.length > 0) {
break;
}
if(this.last.year > 2100) {
break;
}
this.increment_year(this.rule.interval);
}
this._nextByYearDay();
}
in my case the browser was also stuck and putting breakpoints in this loop showed my after some seconds numbers for this.last.year > 44400 which is a little bit out of range.
On top of debugging the actual problem here I see multiple ways to mitigate this and similar issues in the future:
Have a counter and stop after a given amount of instances. This is also something that Sabre/VObject does. Although it's not 100% comparable, since Sabre/VObject is running with limited execution time on the server and ical.js is running in the browser / desktop. If we decide to go for this, i would pick a higher limit than Sabre does.
Do not allow Dates bigger than 31.12.9999
@kewisch Would you be fine with such changes?
Reproducible on latest master: https://github.com/mozilla-comm/ical.js/commit/6702f7b36d6302a740bf06da8e986365a37930fa
Expected behavior
it should create a proper
ICAL.RecurExpansion
objectActual behavior
it ends up in an infinite loop
Code to reproduce
If you run this code, it will only output
foo
and keep running If i comment out theICAL.TimezoneService.register
lines, it also printsbar
and terminates.ical data