2 KiB
evolution-0001: EXDATE dedup O(E^2) in EDateTimeList
Target
GNOME Evolution email/calendar client
Severity
LOW-MEDIUM
MOAD
0001 (CWE-407: Inefficient Algorithmic Complexity)
Location
src/calendar/gui/e-date-time-list.c — e_date_time_list_append()
Called from src/calendar/gui/e-comp-editor-page-recurrence.c — ecep_recurrence_fill_exception_widgets()
Description
e_date_time_list_append() deduplicates exception dates (EXDATE properties
on a recurring calendar event) using g_list_find_custom() on a GList.
When loading a recurring calendar event with E exception dates,
ecep_recurrence_fill_exception_widgets() calls append E times in a for loop.
Each call scans up to E-1 entries already stored: O(1) + O(2) + ... + O(E-1)
= O(E^2/2) total comparisons.
Real events can accumulate hundreds of exception dates over years (e.g., a weekly recurring meeting with individual cancellations).
Fix
Maintain a parallel GHashTable in EDateTimeListPrivate keyed on the
ISO date string (via i_cal_time_as_ical_string()). Membership test in
e_date_time_list_append() becomes O(1). Clear the hash table in
e_date_time_list_clear().
Speedup
| E | Ops (defective) | Ops (fixed) | Ratio |
|---|---|---|---|
| 50 | 1225 | 50 | 24.5x |
| 100 | 4950 | 100 | 49.5x |
| 200 | 19900 | 200 | 99.5x |
| 500 | 124750 | 500 | 249.5x |
| 1000 | 499500 | 1000 | 499.5x |
MOAD-0002 (Intertangle)
src/mail/mail-send-recv.c: static globals send_data, send_recv_dialog,
glob_ongoing_downsyncs are shared mutable state across mail send/receive
operations and UI callbacks. No explicit mutex guards these. Architectural
MOAD-0002, no single-function patch.
MOAD-0003
CLEAN. No ThreadLocal or GPrivate request-scoped identity leakage found.
MOAD-0004
CLEAN. No credential values (passwords, tokens) logged verbatim. Debug messages reference password operations by description only.
MOAD-0005
CLEAN. Evolution uses GLib main loop (single UI thread). No concurrent cache-get+put race conditions.