aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2021-05-28 14:03:16 +0300
committerEli Zaretskii2021-05-28 14:03:16 +0300
commit6d916bfb37d88a63663ad5777c8c3b83fbcfdbd0 (patch)
treead25d1b4e092b0644df860752c1ed89a73867261 /src
parent3fe2f482bd2c636934cfd8e8aa0a07631164831d (diff)
downloademacs-6d916bfb37d88a63663ad5777c8c3b83fbcfdbd0.tar.gz
emacs-6d916bfb37d88a63663ad5777c8c3b83fbcfdbd0.zip
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)
Diffstat (limited to 'src')
-rw-r--r--src/character.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/character.c b/src/character.c
index e44ab8d43b1..e874cf5e53c 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,
339 contains only ascii and eight-bit-graphic, but that's 339 contains only ascii and eight-bit-graphic, but that's
340 intentional. */ 340 intentional. */
341 bool multibyte = SCHARS (string) < SBYTES (string); 341 bool multibyte = SCHARS (string) < SBYTES (string);
342 unsigned char *str = SDATA (string);
343 ptrdiff_t i = from, i_byte = from ? string_char_to_byte (string, from) : 0; 342 ptrdiff_t i = from, i_byte = from ? string_char_to_byte (string, from) : 0;
344 ptrdiff_t from_byte = i_byte; 343 ptrdiff_t from_byte = i_byte;
345 ptrdiff_t width = 0; 344 ptrdiff_t width = 0;
@@ -414,6 +413,7 @@ lisp_string_width (Lisp_Object string, ptrdiff_t from, ptrdiff_t to,
414 else 413 else
415 { 414 {
416 int c; 415 int c;
416 unsigned char *str = SDATA (string);
417 417
418 if (multibyte) 418 if (multibyte)
419 { 419 {