[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 96ac0c3: Yet another fix for using pointers into
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-25 96ac0c3: Yet another fix for using pointers into buffer text |
Date: |
Mon, 24 Oct 2016 18:38:36 +0000 (UTC) |
branch: emacs-25
commit 96ac0c3ebce825e60595794f99e703ec8302e240
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Yet another fix for using pointers into buffer text
* src/search.c (boyer_moore): Update pointers to buffer text
after call to set_search_regs. (Bug#24358)
---
src/search.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/search.c b/src/search.c
index f8acd40..b50e7f0 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2014,13 +2014,20 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
cursor += dirlen - i - direction; /* fix cursor */
if (i + direction == 0)
{
- ptrdiff_t position, start, end;
+ ptrdiff_t position, start, end, cursor_off;
cursor -= direction;
position = pos_byte + cursor - p2 + ((direction > 0)
? 1 - len_byte : 0);
+ /* set_search_regs might call malloc, which could
+ cause ralloc.c relocate buffer text. We need to
+ update pointers into buffer text due to that. */
+ cursor_off = cursor - p2;
set_search_regs (position, len_byte);
+ p_limit = BYTE_POS_ADDR (limit);
+ p2 = BYTE_POS_ADDR (pos_byte);
+ cursor = p2 + cursor_off;
if (NILP (Vinhibit_changing_match_data))
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-25 96ac0c3: Yet another fix for using pointers into buffer text,
Eli Zaretskii <=