bug#3682: 23.1.50; segfault when font style begins with a number

Peter Jolly <[email protected]>
Newsgroups gmane.emacs.bugs,gmane.emacs.pretest.bugs
Message-ID <[email protected]>
get_adstyle_property() in ftfont.c appears to extract the first
whitespace-delimited word from a font's style string and pass it to
font_intern_prop().  When this function is called from ftfont_list()
-- at line 1028 in the current HEAD -- the return value is assumed to
be either nil or a symbol.

I have a font on my computer that has the style "55 Roman".  For this
font, get_adstyle_property() winds up returning an integer instead.
ftfont_list() sticks this into SYMBOL_NAME() and promptly segfaults.

The trivial patch below prevents the crash, but I don't understand the
code well enough to tell whether it's the right solution.  Maybe
ftfont_list() should be handling the integer case instead.


diff --git a/src/ftfont.c b/src/ftfont.c
index 70c1797..789e6a7 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -177,7 +177,7 @@ get_adstyle_property (FcPattern *p)
       || xstrcasecmp (str, "Oblique") == 0
       || xstrcasecmp (str, "Italic") == 0)
     return Qnil;
-  adstyle = font_intern_prop (str, end - str, 0);
+  adstyle = font_intern_prop (str, end - str, 1);
   if (font_style_to_value (FONT_WIDTH_INDEX, adstyle, 0) >= 0)
     return Qnil;
   return adstyle;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.