summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2016-10-23 22:09:43 +0300
committerEli Zaretskii <eliz@gnu.org>2016-10-23 22:09:43 +0300
commitee04aedc723b035eedaf975422d4eb242894121b (patch)
tree6c3255640228ac4ae14247c50982354f82cf702c /src
parent71ca4f6a43bad06192cbc4bb8c7a2d69c179b7b0 (diff)
downloademacs-ee04aedc723b035eedaf975422d4eb242894121b.tar.gz
Fix handling of buffer relocation in regex.c functions
* src/search.c (search_buffer): Updated the base pointer to buffer text after the call to re_search_2. (Bug#24358)
Diffstat (limited to 'src')
-rw-r--r--src/search.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/search.c b/src/search.c
index ec5a1d7733f..5c04916f92e 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1233,6 +1233,8 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
? &search_regs : &search_regs_1),
/* Don't allow match past current point */
pos_byte - BEGV_BYTE);
+ /* Update 'base' due to possible relocation inside re_search_2. */
+ base = current_buffer->text->beg;
if (val == -2)
{
matcher_overflow ();
@@ -1279,6 +1281,8 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
(NILP (Vinhibit_changing_match_data)
? &search_regs : &search_regs_1),
lim_byte - BEGV_BYTE);
+ /* Update 'base' due to possible relocation inside re_search_2. */
+ base = current_buffer->text->beg;
if (val == -2)
{
matcher_overflow ();