Subject: bug#71712: 29.3; Crash on OpenBSD

From: Eli Zaretskii <[email-masked]>
Date: Sat, 22 Jun 2024 10:45:01 +0300

> Date: Sat, 22 Jun 2024 01:01:34 +0100
> From: Kirill A. Korinsky <[email-masked]>
> 
> #8  gui_produce_glyphs (it=0x723f0516bb70) at xdisp.c:31959
>         char2b = <optimized out>
>         face = 0x0
>         font = <optimized out>
>         pcm = <optimized out>
>         boff = <optimized out>
>         extra_line_spacing = 0
> #9  0x00000bf72613ced7 in produce_special_glyphs (it=0x723f0516cf78, what=<optimized out>) at xdisp.c:31605

Thanks.  Is this reproducible?  If so, can you show a recipe,
preferably starting from "emacs -Q"?

FWIW, I looked at the code, and I cannot understand how this could
happen.  The cause of the crash is that 'face' is NULL, so face->font
segfaults.  But 'face' is obtained from 'face_id', which is zero,
i.e. it's the default face:

>        glyph = {ch = 36, face_id = 0}

And init_iterator, which called produce_special_glyphs, makes sure the
basic faces, including the default face, are recomputed just before
the call to produce_special_glyphs:

  if (FRAME_FACE_CACHE (it->f) == NULL)
    init_frame_faces (it->f);
  if (FRAME_FACE_CACHE (it->f)->used == 0)
    recompute_basic_faces (it->f);

And recompute_basic_faces aborts if it is unsuccessful in recomputing
the basic faces, one of which is the default face.  Which didn't
happen here.  So how this could happen is a mystery to me; I'm
probably missing something.