unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* bug#54188: Crash when eval-ing font test elisp code
@ 2024-08-28  8:47 Anand Tamariya
  2024-08-28 12:37 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Anand Tamariya @ 2024-08-28  8:47 UTC (permalink / raw)
  To: Emacs Devel

[-- Attachment #1: Type: text/plain, Size: 255 bytes --]

Today I hit this bug. So I thought I'll provide some additional inputs.

Some old fonts don't support non-ascii characters. In the sample, these
characters are 180, 166 and 216. When such a font is applied as :family
attribute to the text, Emacs crashes.

[-- Attachment #2: Type: text/html, Size: 336 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: bug#54188: Crash when eval-ing font test elisp code
  2024-08-28  8:47 bug#54188: Crash when eval-ing font test elisp code Anand Tamariya
@ 2024-08-28 12:37 ` Eli Zaretskii
  2024-08-28 15:04   ` Anand Tamariya
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-08-28 12:37 UTC (permalink / raw)
  To: Anand Tamariya; +Cc: emacs-devel

> From: Anand Tamariya <atamariya@gmail.com>
> Date: Wed, 28 Aug 2024 14:17:10 +0530
> 
> Today I hit this bug. So I thought I'll provide some additional inputs.
> 
> Some old fonts don't support non-ascii characters. In the sample, these characters are 180, 166 and 216.
> When such a font is applied as :family attribute to the text, Emacs crashes.

Can you give examples of such fonts, and show a GDB C-level backtrace
from the crash?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: bug#54188: Crash when eval-ing font test elisp code
  2024-08-28 12:37 ` Eli Zaretskii
@ 2024-08-28 15:04   ` Anand Tamariya
  2024-08-28 15:29     ` Pip Cet
  2024-08-28 18:07     ` Eli Zaretskii
  0 siblings, 2 replies; 9+ messages in thread
From: Anand Tamariya @ 2024-08-28 15:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 3153 bytes --]

On Wed, Aug 28, 2024 at 6:07 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Anand Tamariya <atamariya@gmail.com>
> > Date: Wed, 28 Aug 2024 14:17:10 +0530
> >
> > Today I hit this bug. So I thought I'll provide some additional inputs.
> >
> > Some old fonts don't support non-ascii characters. In the sample, these
> characters are 180, 166 and 216.
> > When such a font is applied as :family attribute to the text, Emacs
> crashes.
>
> Can you give examples of such fonts, and show a GDB C-level backtrace
> from the crash?
>
I always get the crash when I scroll to the next page after the page in the
screenshot. I can't point out the specific font. So I have listed the
possible fonts on the next screen.


*Stacktrace:*
Thread 1 "temacs" received signal SIGSEGV, Segmentation fault.
0x00005555557fceb1 in fontset_find_font (fontset=fontset@entry=0x6c,
    c=c@entry=180, face=face@entry=0x555559804320,
    charset_id=charset_id@entry=-1, fallback=fallback@entry=false)
    at fontset.c:556
556  struct frame *f = (FRAMEP (FONTSET_FRAME (fontset))
(gdb) bt
#0  0x00005555557fceb1 in fontset_find_font
    (fontset=fontset@entry=0x6c, c=c@entry=180, face=face@entry=0x555559804320,
charset_id=charset_id@entry=-1, fallback=fallback@entry=false) at
fontset.c:556
#1  0x00005555557fd860 in fontset_font
    (fontset=fontset@entry=0x6c, c=c@entry=180, face=face@entry=0x555559804320,
id=-1) at fontset.c:767
#2  0x00005555557fdc1c in face_for_char
    (f=0x555556624d90, face=face@entry=0x555559804320, c=c@entry=180,
pos=<optimized out>, object=<optimized out>) at fontset.c:997
#3  0x000055555561386f in FACE_FOR_CHAR
    (object=<optimized out>, pos=<optimized out>, character=180,
face=0x555559804320, f=<optimized out>) at
/opt/Users/a_tam/work/emacs/src/dispextern.h:1896
#4  get_next_display_element (it=it@entry=0x7fffffff8590) at xdisp.c:7613
#5  0x000055555561c622 in display_line
    (it=it@entry=0x7fffffff8590, cursor_vpos=cursor_vpos@entry=0)
    at xdisp.c:23176
#6  0x0000555555627f6b in try_window
    (window=window@entry=0x555556625da5, pos=..., flags=0) at xdisp.c:19082
#7  0x0000555555642bdc in redisplay_window
    (window=<optimized out>, just_this_one_p=just_this_one_p@entry=false)
    at xdisp.c:18233
#8  0x0000555555645d7b in redisplay_window_0
    (window=window@entry=0x555556625da5) at xdisp.c:16214

*Font list*
Arundina Sans
Arundina Sans Mono
Arundina Serif
avant garde gothic
avantgarde
Bitstream Charter
bookman
BPG Algeti GPL&GNU
BPG Chveulebrivi GPL&GNU
BPG Courier GPL&GNU
BPG Courier S GPL&GNU
BPG DedaEna Block GPL&GNU
BPG DejaVu Sans 2011 GNU-GPL
BPG Elite GPL&GNU
BPG Excelsior Caps GPL&GNU
BPG Excelsior Condencerd GPL&GNU
BPG Excelsior GPL&GNU
BPG Glaho GPL&GNU
BPG Gorda GPL&GNU
BPG Ingiri GPL&GNU
BPG Mrgvlovani Caps GNU&GPL
BPG Mrgvlovani GPL&GNU
BPG Nateli Caps GPL&GNU
BPG Nateli Condenced GPL&GNU
BPG Nateli GPL&GNU
BPG Nino Medium Cond GPL&GNU
BPG Nino Medium GPL&GNU
BPG Sans GPL&GNU
BPG Sans Medium GPL&GNU
BPG Sans Modern GPL&GNU
BPG Sans Regular GPL&GNU
BPG Serif GPL&GNU
BPG Serif Modern GPL&GNU
C059

[-- Attachment #1.2: Type: text/html, Size: 3970 bytes --]

[-- Attachment #2: crash1.png --]
[-- Type: image/png, Size: 710591 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: bug#54188: Crash when eval-ing font test elisp code
  2024-08-28 15:04   ` Anand Tamariya
@ 2024-08-28 15:29     ` Pip Cet
  2024-08-28 15:54       ` Eli Zaretskii
  2024-08-28 18:07     ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Pip Cet @ 2024-08-28 15:29 UTC (permalink / raw)
  To: Anand Tamariya; +Cc: Eli Zaretskii, emacs-devel

"Anand Tamariya" <atamariya@gmail.com> writes:

> On Wed, Aug 28, 2024 at 6:07 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
>  > From: Anand Tamariya <atamariya@gmail.com>
>  > Date: Wed, 28 Aug 2024 14:17:10 +0530
>  > 
>  > Today I hit this bug. So I thought I'll provide some additional inputs.
>  > 
>  > Some old fonts don't support non-ascii characters. In the sample, these characters are 180, 166 and 216.
>  > When such a font is applied as :family attribute to the text, Emacs crashes.
>
>  Can you give examples of such fonts, and show a GDB C-level backtrace
>  from the crash?
>
> I always get the crash when I scroll to the next page after the page in the screenshot. I can't point out the specific font. So I have listed the possible
> fonts on the next screen.
>
>  
> Stacktrace:
> Thread 1 "temacs" received signal SIGSEGV, Segmentation fault.
> 0x00005555557fceb1 in fontset_find_font (fontset=fontset@entry=0x6c, 
>     c=c@entry=180, face=face@entry=0x555559804320, 
>     charset_id=charset_id@entry=-1, fallback=fallback@entry=false)
>     at fontset.c:556
> 556  struct frame *f = (FRAMEP (FONTSET_FRAME (fontset))
> (gdb) bt
> #0  0x00005555557fceb1 in fontset_find_font
>     (fontset=fontset@entry=0x6c, c=c@entry=180, face=face@entry=0x555559804320, charset_id=charset_id@entry=-1,
> fallback=fallback@entry=false) at fontset.c:556

Can you print *face or "p face->fontset" and "p face->font"? I rather
suspect face->fontset is -1, but face->font is non-NULL.

That would make Vfontset_table a vector of 0x6c = 108 entries, which
seems reasonable (it starts out at 32 entries, and larger_vector
increases it to 48, then 72, then 108).

This code in fontset.c:

  /* If the parent face has no fontset we could work with, and has no
     font, just return that same face, so that the caller will
     consider the character to have no font capable of displaying it,
     and display it as "glyphless".  That is certainly better than
     violating the assertion below or crashing when assertions are not
     compiled in.  */
  if (face->fontset < 0 && !face->font)
    return face->id;

would leave face->fontset at -1 and try to dereference it if face->font
is non-NULL, and I don't understand why.

Thanks
Pip




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: bug#54188: Crash when eval-ing font test elisp code
  2024-08-28 15:29     ` Pip Cet
@ 2024-08-28 15:54       ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2024-08-28 15:54 UTC (permalink / raw)
  To: Pip Cet; +Cc: atamariya, emacs-devel

> Date: Wed, 28 Aug 2024 15:29:11 +0000
> From: Pip Cet <pipcet@protonmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> 
> This code in fontset.c:
> 
>   /* If the parent face has no fontset we could work with, and has no
>      font, just return that same face, so that the caller will
>      consider the character to have no font capable of displaying it,
>      and display it as "glyphless".  That is certainly better than
>      violating the assertion below or crashing when assertions are not
>      compiled in.  */
>   if (face->fontset < 0 && !face->font)
>     return face->id;
> 
> would leave face->fontset at -1 and try to dereference it if face->font
> is non-NULL, and I don't understand why.

I didn't yet review the relevant code, but AFAIR face->fontset = -1
means the face has no fontset, and I think I saw in xfaces.c code
which handles that.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: bug#54188: Crash when eval-ing font test elisp code
  2024-08-28 15:04   ` Anand Tamariya
  2024-08-28 15:29     ` Pip Cet
@ 2024-08-28 18:07     ` Eli Zaretskii
  2024-08-29  4:54       ` Anand Tamariya
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-08-28 18:07 UTC (permalink / raw)
  To: Anand Tamariya; +Cc: emacs-devel

> From: Anand Tamariya <atamariya@gmail.com>
> Date: Wed, 28 Aug 2024 20:34:17 +0530
> Cc: emacs-devel@gnu.org
> 
>  Can you give examples of such fonts, and show a GDB C-level backtrace
>  from the crash?
> 
> I always get the crash when I scroll to the next page after the page in the screenshot. I can't point out the
> specific font. So I have listed the possible fonts on the next screen.

Thanks.  What version of Emacs is this?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: bug#54188: Crash when eval-ing font test elisp code
  2024-08-28 18:07     ` Eli Zaretskii
@ 2024-08-29  4:54       ` Anand Tamariya
  2024-08-29  5:11         ` Yuri Khan
  2024-08-29  6:02         ` Eli Zaretskii
  0 siblings, 2 replies; 9+ messages in thread
From: Anand Tamariya @ 2024-08-29  4:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 775 bytes --]

On Wed, Aug 28, 2024 at 11:37 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Anand Tamariya <atamariya@gmail.com>
> > Date: Wed, 28 Aug 2024 20:34:17 +0530
> > Cc: emacs-devel@gnu.org
> >
> >  Can you give examples of such fonts, and show a GDB C-level backtrace
> >  from the crash?
> >
> > I always get the crash when I scroll to the next page after the page in
> the screenshot. I can't point out the
> > specific font. So I have listed the possible fonts on the next screen.
>
> Thanks.  What version of Emacs is this?
>
This problem is not present in the latest version (tested with Emacs 29.4).
To summarize, if you're facing the crash, do one of the following:
- Remove the characters 180, 166 and 216.
- Upgrade to the latest version of Emacs

[-- Attachment #2: Type: text/html, Size: 1282 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: bug#54188: Crash when eval-ing font test elisp code
  2024-08-29  4:54       ` Anand Tamariya
@ 2024-08-29  5:11         ` Yuri Khan
  2024-08-29  6:02         ` Eli Zaretskii
  1 sibling, 0 replies; 9+ messages in thread
From: Yuri Khan @ 2024-08-29  5:11 UTC (permalink / raw)
  To: Anand Tamariya; +Cc: Eli Zaretskii, emacs-devel

On Thu, 29 Aug 2024 at 11:56, Anand Tamariya <atamariya@gmail.com> wrote:

> - Remove the characters 180, 166 and 216.

It’s not common to refer to characters by their decimal code. Most of
the time, it will be clearer to cite the hexadecimal code and Unicode
name:

U+00B4 ACUTE ACCENT
U+00A6 BROKEN BAR
U+00D8 LATIN CAPITAL LETTER O WITH STROKE



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: bug#54188: Crash when eval-ing font test elisp code
  2024-08-29  4:54       ` Anand Tamariya
  2024-08-29  5:11         ` Yuri Khan
@ 2024-08-29  6:02         ` Eli Zaretskii
  1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2024-08-29  6:02 UTC (permalink / raw)
  To: Anand Tamariya; +Cc: emacs-devel

> From: Anand Tamariya <atamariya@gmail.com>
> Date: Thu, 29 Aug 2024 10:24:56 +0530
> Cc: emacs-devel@gnu.org
> 
> On Wed, Aug 28, 2024 at 11:37 PM Eli Zaretskii <eliz@gnu.org> wrote:
> 
>  Thanks.  What version of Emacs is this?
> 
> This problem is not present in the latest version (tested with Emacs 29.4). To summarize, if you're facing the
> crash, do one of the following:
> - Remove the characters 180, 166 and 216.
> - Upgrade to the latest version of Emacs

OK, thanks.  This matches my experience: I couldn't reproduce with the
current release branch (which will soon become Emacs 30.1).



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-08-29  6:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-28  8:47 bug#54188: Crash when eval-ing font test elisp code Anand Tamariya
2024-08-28 12:37 ` Eli Zaretskii
2024-08-28 15:04   ` Anand Tamariya
2024-08-28 15:29     ` Pip Cet
2024-08-28 15:54       ` Eli Zaretskii
2024-08-28 18:07     ` Eli Zaretskii
2024-08-29  4:54       ` Anand Tamariya
2024-08-29  5:11         ` Yuri Khan
2024-08-29  6:02         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).