From: pok@netfonds.no (Peder O. Klingenberg)
To: npostavs@users.sourceforge.net
Cc: 24315@debbugs.gnu.org
Subject: bug#24315: 25.1.50; re-search-forward errors with "Variable binding depth exceeds max-specpdl-size"
Date: Tue, 30 Aug 2016 15:09:34 +0200 [thread overview]
Message-ID: <ksvayi2yk1.fsf@luna.netfonds.no> (raw)
In-Reply-To: <87twe6sx2g.fsf@users.sourceforge.net> (npostavs's message of "Fri, 26 Aug 2016 23:35:51 -0400")
[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]
On Fri, Aug 26 2016 at 23:35, npostavs@users.sourceforge.net wrote:
> This looks like it would be an inefficient regexp, since it has nested
> stars. I suspect searching for "^[ \t]" multiple times would be more
> efficient than trying to match multiple lines in a single regexp.
Tried that. It sort of worked, in that it worked when I directly called
`icalendar--read-event' in a buffer containing the event as manually
extracted from the gnus message.
However, parsing the problematic message in gnus still failed. It turns
out `gnus-icalendar-event-from-buffer' calls
`icalendar--get-unfolded-buffer' before `icalendar--read-event'.
`icalendar--get-unfolded-buffer' takes care of all those pesky line
continuations, and returns a buffer with each element occupying exactly
one line. So essentially `icalendar--read-event' was using a regexp to
extract the rest of the line, and that failed with a line nearly 40k
characters long.
The only other in-tree caller of `icalendar--read-event' (excluding
itself) also calls `icalendar--get-unfolded-buffer' first, and indeed,
`icalendar-read-event' already relies on this to take care of line
continuations in element parameters (as opposed to values).
Attached is a patch that uses buffer-substring to accomplish the same
thing as the offending regexp, and documents the dependency on
`icalendar--get-unfolded-buffer'. This fixes the problem for me.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bug24315.patch --]
[-- Type: text/x-diff, Size: 1540 bytes --]
From c3ae84dc48a993bb1906d5c9b6b663184e2a9d9d Mon Sep 17 00:00:00 2001
From: "Peder O. Klingenberg" <peder@klingenberg.no>
Date: Tue, 30 Aug 2016 14:44:16 +0200
Subject: [PATCH] Avoid crash in icalendar--read-element
* lisp/calendar/icalendar.el (icalendar--read-element): Stop crashing
when parsing overly long event descriptions. (Bug#24315)
---
lisp/calendar/icalendar.el | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index 386c554..19930d5 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -361,7 +361,8 @@ icalendar--read-element
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,8 @@ icalendar--read-element
(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)))
+ (setq value (buffer-substring (point) (line-end-position)))
+ (end-of-line)
(setq line (list name params value))
(cond ((eq name 'BEGIN)
(setq children
--
2.9.3
next prev parent reply other threads:[~2016-08-30 13:09 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 20:17 bug#24315: 25.1.50; re-search-forward errors with "Variable binding depth exceeds max-specpdl-size" Peder O. Klingenberg
2016-08-27 3:35 ` npostavs
2016-08-30 13:09 ` Peder O. Klingenberg [this message]
2016-09-02 1:58 ` npostavs
2016-09-02 13:45 ` Peder O. Klingenberg
2016-09-03 14:21 ` npostavs
2016-09-06 8:18 ` Peder O. Klingenberg
2016-09-07 23:27 ` npostavs
2016-09-03 15:43 ` bug#24358: " npostavs
2016-10-08 0:29 ` npostavs
2016-10-08 5:55 ` Eli Zaretskii
2016-10-08 13:45 ` npostavs
2016-10-08 14:39 ` Eli Zaretskii
2016-10-08 14:47 ` Eli Zaretskii
2016-10-08 16:57 ` npostavs
2016-10-08 17:23 ` Eli Zaretskii
2016-10-08 18:52 ` npostavs
2016-10-08 19:47 ` Eli Zaretskii
2016-10-08 20:55 ` npostavs
2016-10-09 6:52 ` Eli Zaretskii
2016-10-13 1:29 ` npostavs
2016-10-13 6:19 ` Eli Zaretskii
2016-10-14 2:19 ` npostavs
2016-10-14 7:02 ` Eli Zaretskii
2016-10-19 3:11 ` npostavs
2016-10-19 7:02 ` Eli Zaretskii
2016-10-19 12:29 ` npostavs
2016-10-19 14:37 ` Eli Zaretskii
2016-10-20 4:31 ` npostavs
2016-10-20 8:39 ` Eli Zaretskii
2016-10-21 1:22 ` npostavs
2016-10-21 7:17 ` Eli Zaretskii
2016-10-22 2:36 ` npostavs
2016-10-22 21:54 ` Sam Halliday
2016-10-22 22:46 ` npostavs
2016-10-23 6:41 ` Eli Zaretskii
2016-10-23 8:57 ` Sam Halliday
2016-10-23 9:19 ` Eli Zaretskii
2016-10-23 13:40 ` Sam Halliday
2016-10-23 14:07 ` Eli Zaretskii
2016-10-23 15:42 ` Sam Halliday
2016-10-23 15:48 ` Eli Zaretskii
2016-10-23 15:58 ` Sam Halliday
2016-10-23 15:58 ` Sam Halliday
2016-10-23 16:44 ` Eli Zaretskii
2016-10-23 17:19 ` Eli Zaretskii
2016-10-23 18:06 ` Eli Zaretskii
2016-10-23 18:14 ` Noam Postavsky
2016-10-23 19:18 ` Eli Zaretskii
2016-10-24 13:29 ` npostavs
2016-10-24 13:39 ` Eli Zaretskii
2016-10-24 15:33 ` Noam Postavsky
2016-10-24 16:13 ` Eli Zaretskii
2016-10-25 2:00 ` npostavs
2016-10-25 16:03 ` Eli Zaretskii
2016-10-26 0:16 ` npostavs
2016-10-24 13:43 ` Eli Zaretskii
2016-10-24 14:03 ` Eli Zaretskii
2016-10-24 20:13 ` Sam Halliday
2016-10-24 23:44 ` npostavs
2016-11-07 3:39 ` Eli Zaretskii
2016-11-07 3:56 ` Noam Postavsky
2016-11-07 15:10 ` Eli Zaretskii
2016-10-23 18:16 ` Sam Halliday
2016-10-23 19:10 ` Eli Zaretskii
2016-10-23 19:32 ` Eli Zaretskii
2016-10-23 20:15 ` Sam Halliday
2016-10-23 20:27 ` Eli Zaretskii
2016-10-23 20:18 ` Eli Zaretskii
2016-10-23 23:18 ` Noam Postavsky
2016-10-24 7:05 ` Eli Zaretskii
2016-10-24 8:40 ` Eli Zaretskii
2016-10-23 18:11 ` Sam Halliday
2016-10-18 8:16 ` bug#24358: 25.1.50; Sam Halliday
2016-10-18 8:56 ` Sam Halliday
2016-10-18 9:28 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ksvayi2yk1.fsf@luna.netfonds.no \
--to=pok@netfonds.no \
--cc=24315@debbugs.gnu.org \
--cc=npostavs@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).