From 20e4dced4075ab3e608f62abf68355034f7f866a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Mon, 17 Oct 2022 20:29:59 +0200 Subject: [PATCH] Fix OOM when having a lot of recurrence rules We had a broken client that created calendar entries with a lot of recurrence rule (all of them FREQ=WEEKLY) and a lot of alarms. This led to SOGo going out of memory. This patch works around that by filtering out duplicated rules as they yield the same date ranges and we only need to have them once. --- SoObjects/Appointments/SOGoAppointmentFolder.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index a5806d996..2c4380081 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -1358,7 +1358,9 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir rules = [component recurrenceRulesWithTimeZone: tz]; exRules = [component exceptionRulesWithTimeZone: tz]; } - + + rules = [rules uniqueObjects]; + // Calculate the occurrences for the given range records = [NSMutableArray array]; ranges =