prevent potential freebusy lookup crashes during timezone changes with repetitive events

This commit is contained in:
Ludovic Marcotte
2015-03-24 11:07:11 -04:00
parent 5fb8f35951
commit d45c22523e
2 changed files with 6 additions and 2 deletions
+1
View File
@@ -23,6 +23,7 @@ Bug fixes
- fixed EAS handling of Bcc in emails (#3138)
- fixed Language-Region tags in Web interface (#3121)
- properly fallback over EAS to UTF-8 and then Latin1 for messages w/o charset (#3103)
- prevent potential freebusy lookup crashes during timezone changes with repetitive events
2.2.16 (2015-02-12)
-------------------
+5 -2
View File
@@ -155,6 +155,7 @@
delta = [[currentDate timeZoneDetail] timeZoneSecondsFromGMT] - [[startDate timeZoneDetail] timeZoneSecondsFromGMT];
startInterval += (delta/60/15);
startInterval = (startInterval < -4 ? -4 : startInterval);
currentDate = [record objectForKey: @"endDate"];
if ([currentDate earlierDate: endDate] == endDate)
@@ -165,6 +166,8 @@
delta = [[currentDate timeZoneDetail] timeZoneSecondsFromGMT] - [[startDate timeZoneDetail] timeZoneSecondsFromGMT];
endInterval += (delta/60/15);
endInterval = (endInterval < 0 ? 0 : endInterval);
endInterval = (endInterval > itemCount+4 ? itemCount+4 : endInterval);
// Update bit string representation
// If the user is a resource with restristed amount of bookings, keep the sum of overlapping events
@@ -230,7 +233,7 @@
intervals = interval / intervalSeconds + 8;
// Build a bit string representation of the freebusy data for the period
freeBusyItems = NSZoneCalloc (NULL, intervals, sizeof (int));
freeBusyItems = calloc(intervals, sizeof (unsigned int));
[self _fillFreeBusyItems: (freeBusyItems+4)
count: (intervals-4)
withRecords: [fb fetchFreeBusyInfosFrom: start to: end forContact: uid]
@@ -243,7 +246,7 @@
{
[freeBusy addObject: [NSString stringWithFormat: @"%d", *(freeBusyItems + count)]];
}
NSZoneFree (NULL, freeBusyItems);
free(freeBusyItems);
// Return a NSString representation
return [freeBusy componentsJoinedByString: @","];