all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 34910@debbugs.gnu.org
Subject: bug#34910: 27.0.50; Too much matching reentrancy
Date: Tue, 19 Mar 2019 13:50:00 +0100	[thread overview]
Message-ID: <66172e4bc6e70e23d7bf3175a5c83519a43c1a66.camel@acm.org> (raw)
In-Reply-To: <8336njuqrd.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

Here is another improvement: there should be no reason to keep the
regexp busy during the overflow error processing, so release it first.

By the way, is there any reason why only calls to re_search_2 are made
with a busy-marked regexp buffer, not calls to re_search? Are the
latter guaranteed not to be reentrant?


[-- Attachment #2: 0001-Release-regexp-before-signalling-overflow-error.patch --]
[-- Type: text/x-patch, Size: 1474 bytes --]

From 3c7555bf0fc38db94d87923869cb48d57b12605a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Tue, 19 Mar 2019 13:47:13 +0100
Subject: [PATCH] Release regexp before signalling overflow error

src/search.c (looking_at_1, search_buffer_re): Unfreeze the regexp buffer
before signalling a matcher overflow, since the error processing may
require quite some regexp use as well (Bug#34910).
---
 src/search.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/search.c b/src/search.c
index 2c00e6e93f..b61f65a77c 100644
--- a/src/search.c
+++ b/src/search.c
@@ -344,7 +344,10 @@ looking_at_1 (Lisp_Object string, bool posix)
 		  ZV_BYTE - BEGV_BYTE);
 
   if (i == -2)
-    matcher_overflow ();
+    {
+      unbind_to (count, Qnil);
+      matcher_overflow ();
+    }
 
   val = (i >= 0 ? Qt : Qnil);
   if (preserve_match_data && i >= 0)
@@ -1223,6 +1226,7 @@ search_buffer_re (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
                          pos_byte - BEGV_BYTE);
       if (val == -2)
         {
+          unbind_to (count, Qnil);
           matcher_overflow ();
         }
       if (val >= 0)
@@ -1268,6 +1272,7 @@ search_buffer_re (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
                          lim_byte - BEGV_BYTE);
       if (val == -2)
         {
+          unbind_to (count, Qnil);
           matcher_overflow ();
         }
       if (val >= 0)
-- 
2.20.1


  parent reply	other threads:[~2019-03-19 12:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 21:34 bug#34910: 27.0.50; Too much matching reentrancy Mattias Engdegård
2019-03-19  8:05 ` Eli Zaretskii
2019-03-19  9:27   ` Mattias Engdegård
2019-03-19 10:01     ` Eli Zaretskii
2019-03-19 12:25       ` Mattias Engdegård
2019-03-19 12:31         ` Eli Zaretskii
2019-03-30  9:29         ` Eli Zaretskii
2019-03-19 12:50       ` Mattias Engdegård [this message]
2019-03-30  9:30         ` Eli Zaretskii
2019-03-30 11:18           ` Mattias Engdegård
2019-03-30 14:52             ` Daniel Colascione
2019-03-30 12:55           ` Stefan Monnier
2019-03-30 13:05             ` Mattias Engdegård
2019-03-30 13:37               ` Eli Zaretskii
2019-03-30 16:22               ` Stefan Monnier
2019-03-30 17:10                 ` Daniel Colascione
2019-03-30 19:06                   ` Mattias Engdegård

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=66172e4bc6e70e23d7bf3175a5c83519a43c1a66.camel@acm.org \
    --to=mattiase@acm.org \
    --cc=34910@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.