Subject: bug#72692: Emacs 31.05 (40eecd594ac) get SIGSEGV on Linux (Linux 6.6.45 Kde Wayland)

From: Eli Zaretskii <[email-masked]>
Date: Wed, 28 Aug 2024 15:51:42 +0300

> Date: Wed, 28 Aug 2024 12:07:05 +0000
> From: Pip Cet <[email-masked]>
> Cc: [email-masked], [email-masked], [email-masked]
> 
> >> >> The code path without assertions is similar, it just that the
> >> >> XCHAR_TABLE happens further down the call stack, in fontset_find_font.
> >> >> See the original backtrace.
> >> >
> >> > OK, so adding protection against fontset being nil, where we currently
> >> > lack that, should take care of these cases, right?
> >>
> >> It'll turn a segfaulting bug into a wrong-behavior bug.
> >
> > That depends on what the code we install to handle the nil case will
> > do, no?  If we do it correctly (assuming there is a correct way of
> > handling this), there will be no wrong behavior, right?
> 
> Yes, but that would require much more than checking for nil, it would
> mean checking that the fontset entry is still valid and refers to the
> same fontset it did originally, not a new fontset.

Yes, for the case of a non-nil but different fontset we need a
separate fix.  But that is a separate problem; I was talking only
about the case when the fontset was removed from the cache and its
slot set to nil.  We already have tests for this in many cases, but
not in all of them.

I will try to come up with something when I have time.