From 3c7555bf0fc38db94d87923869cb48d57b12605a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= 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