[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 6d916bf: Another stability fix in 'lisp_string_width'
From: |
Eli Zaretskii |
Subject: |
master 6d916bf: Another stability fix in 'lisp_string_width' |
Date: |
Fri, 28 May 2021 07:04:09 -0400 (EDT) |
branch: master
commit 6d916bfb37d88a63663ad5777c8c3b83fbcfdbd0
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Another stability fix in 'lisp_string_width'
* src/character.c (lisp_string_width): Compute C pointer to data
of STRING immediately before using it, since STRING could be
relocated by GC triggered by processing compositions. (Bug#48711)
---
src/character.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/character.c b/src/character.c
index e44ab8d..e874cf5 100644
--- a/src/character.c
+++ b/src/character.c
@@ -339,7 +339,6 @@ lisp_string_width (Lisp_Object string, ptrdiff_t from,
ptrdiff_t to,
contains only ascii and eight-bit-graphic, but that's
intentional. */
bool multibyte = SCHARS (string) < SBYTES (string);
- unsigned char *str = SDATA (string);
ptrdiff_t i = from, i_byte = from ? string_char_to_byte (string, from) : 0;
ptrdiff_t from_byte = i_byte;
ptrdiff_t width = 0;
@@ -414,6 +413,7 @@ lisp_string_width (Lisp_Object string, ptrdiff_t from,
ptrdiff_t to,
else
{
int c;
+ unsigned char *str = SDATA (string);
if (multibyte)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 6d916bf: Another stability fix in 'lisp_string_width',
Eli Zaretskii <=