From 56a3ed860b85ade4ccbcc42a4149fa9d83c34420 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 13 Jul 2026 15:30:27 -0500 Subject: fix(calendar-sync): stop EXDATE scan loop on comma-separated values calendar-sync--get-exdates read (match-end 0) after split-string, whose internal matching clobbers the match data. The scan position jumped back to a comma offset inside the value and re-matched the same EXDATE line forever, growing the result list until the kernel OOM killer took the whole session down (twice, 2026-07-13). The fix captures the line's end position before the split. The comma-separated tests added with a9e61207 were the first code to hit this path. All 12 exdates tests and all 56 calendar-sync test files now pass in milliseconds. --- modules/calendar-sync-recurrence.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'modules/calendar-sync-recurrence.el') diff --git a/modules/calendar-sync-recurrence.el b/modules/calendar-sync-recurrence.el index bc1cc92f..2689cdd6 100644 --- a/modules/calendar-sync-recurrence.el +++ b/modules/calendar-sync-recurrence.el @@ -195,10 +195,16 @@ Handles both simple values and values with parameters like TZID." (pos 0)) ;; Find all EXDATE lines. One line may carry several comma-separated ;; datetimes (RFC 5545); split them so each is excluded individually. + ;; Capture the match end BEFORE split-string: its internal matching + ;; clobbers the match data, and reading (match-end 0) afterwards made + ;; pos jump backwards to a comma offset inside the value -- re-matching + ;; the same line forever and growing the list until the OOM killer + ;; intervened (took two agent sessions down on 2026-07-13). (while (string-match "^EXDATE[^:\n]*:\\([^\n]+\\)" event-str pos) - (dolist (val (split-string (match-string 1 event-str) "," t)) - (push val exdates)) - (setq pos (match-end 0))) + (let ((line-end (match-end 0))) + (dolist (val (split-string (match-string 1 event-str) "," t)) + (push val exdates)) + (setq pos line-end))) (nreverse exdates)))) (defun calendar-sync--get-exdate-line (event-str exdate-value) -- cgit v1.2.3