Subject: Re: bug#48711: Crashes in lisp_string_width

From: Eli Zaretskii <[email-masked]>
Date: Fri, 28 May 2021 10:11:35 +0300

> From: Juri Linkov <[email-masked]>
> Date: Fri, 28 May 2021 09:37:49 +0300
> 
> Yesterday's changes in lisp_string_width cause crashes:
> 
> Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
> composition_gstring_width (gstring=<optimized out>, from=1, from@entry=0, to=12, metrics=metrics@entry=0x0) at composite.c:777
> 777	      if (NILP (LGLYPH_ADJUSTMENT (*glyph)))
> (gdb) bt
> #0  composition_gstring_width (gstring=<optimized out>, from=1, from@entry=0, to=12, metrics=metrics@entry=0x0) at composite.c:777
> #1  0x0000555555642ff7 in lisp_string_width (string=string@entry=XIL(0x555557825e54), from=from@entry=0, to=to@entry=1, precision=precision@entry=-1, nchars=nchars@entry=0x7fffffff4850, nbytes=nbytes@entry=0x7fffffff4858) at lisp.h:1644
> #2  0x000055555570c46e in styled_format (nargs=<optimized out>, args=<optimized out>, message=<optimized out>) at editfns.c:3392
> #3  0x0000555555716690 in Ffuncall (nargs=4, args=args@entry=0x7fffffffa060) at lisp.h:2093

Thanks, but I need a recipe to reproduce this, and/or at least some
idea about which variables cause the problem.  The backtrace you show
is from an optimized build where the values of the relevant variables
are all "optimized out".  That doesn't give me much to work with, and
there are no other experts on composite.c on board to help.  So I need
all the help you can provide to fix this.

TIA