summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorPeder O. Klingenberg <peder@klingenberg.no>2016-08-30 14:44:16 +0200
committerNoam Postavsky <npostavs@gmail.com>2016-10-02 12:27:33 -0400
commit5e50114d2495dab67793e76411d10c93bf411e03 (patch)
tree9cd1de70180b765d93b27e4e97eeae104fe257f7 /lisp
parentace9d227dd5fd0c81c456e75a40ea36d169a0d58 (diff)
downloademacs-5e50114d2495dab67793e76411d10c93bf411e03.tar.gz
emacs-5e50114d2495dab67793e76411d10c93bf411e03.tar.bz2
emacs-5e50114d2495dab67793e76411d10c93bf411e03.zip
Avoid error in icalendar--read-element
* lisp/calendar/icalendar.el (icalendar--read-element): Avoid a regex stack overflow by not using regex to extract values from calendar events. (Bug#24315) (cherry picked from commit 55dde6c1a21a792d3d75c19e612c74dd054aaf1e)
Diffstat (limited to 'lisp')
-rw-r--r--lisp/calendar/icalendar.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index 386c554c068..c88f4abcb6e 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -361,7 +361,8 @@ Pass arguments REGEXP REP STRING FIXEDCASE LITERAL to
INVALUE gives the current iCalendar element we are reading.
INPARAMS gives the current parameters.....
This function calls itself recursively for each nested calendar element
-it finds."
+it finds. The current buffer should be an unfolded buffer as returned
+from `icalendar--get-unfolded-buffer'."
(let (element children line name params param param-name param-value
value
(continue t))
@@ -391,8 +392,9 @@ it finds."
(unless (looking-at ":")
(error "Oops"))
(forward-char 1)
- (re-search-forward "\\(.*\\)\\(\r?\n[ \t].*\\)*" nil t)
- (setq value (icalendar--rris "\r?\n[ \t]" "" (match-string 0)))
+ (let ((start (point)))
+ (end-of-line)
+ (setq value (buffer-substring start (point))))
(setq line (list name params value))
(cond ((eq name 'BEGIN)
(setq children