diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-13 15:30:27 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-13 15:30:27 -0500 |
| commit | 56a3ed860b85ade4ccbcc42a4149fa9d83c34420 (patch) | |
| tree | fa3544b12aa790e9df28cb03a2fc415aa1e97d0b /modules | |
| parent | a9e61207f6c806271cbc69fe27fde04b22e34e0a (diff) | |
| download | dotemacs-56a3ed860b85ade4ccbcc42a4149fa9d83c34420.tar.gz dotemacs-56a3ed860b85ade4ccbcc42a4149fa9d83c34420.zip | |
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.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/calendar-sync-recurrence.el | 12 |
1 files changed, 9 insertions, 3 deletions
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) |
