Commit ee04aedc authored by Eli Zaretskii's avatar Eli Zaretskii

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)
parent 71ca4f6a
......@@ -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 ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment