emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs xfont.c doing XINT(nil)


From: Ken Raeburn
Subject: emacs xfont.c doing XINT(nil)
Date: Sat, 25 Jul 2009 21:41:50 -0400

In xfont.c around line 400 or so, font_parse_xlfd is called without checking its return value. On Mac OS X, building for X11, I'm seeing font_parse_xlfd get passed "7x14" and return -1, indicating that it hasn't filled in the fields of "entity". So a few lines further down, when checking for scalable fonts, XINT is applied to a couple of array elements that are actually nil.

I'm working on some changes which, among other things, really want XINT/XUINT to only get applied to Lisp objects that represent integers, so I noticed. Otherwise, I haven't noticed any problems... but I don't know what I would be looking for anyways, as I don't do much with fonts in Emacs. I do have "Emacs*font: 7x14" set in my X resources though, from long ago.

With some printf instrumentation, I'm seeing these calls being mode (and showing the count and names returned by XListFonts):

xfont_list_pattern(-*-7x14-*-*-*-*-*-*-*-*-*-*-iso8859-1) -> 0 matches
xfont_list_pattern(7x14) -> 1 matches
 font #  0 = '7x14'
 font_parse_xlfd returns -1
xfont_list_pattern(-*-7x14-*-*-*-*-*-*-*-*-*-*-ascii-0) -> 0 matches
xfont_list_pattern(7x14) -> 1 matches
 font #  0 = '7x14'
 font_parse_xlfd returns -1
font_list_pattern(-misc-fixed-*-*-*--*-*-*-*-*-*-iso8859-1) -> 53 matches
[...everything looks happy...]
xfont_list_pattern(-misc-fixed-*-*-*--*-*-*-*-c-*-iso8859-1) -> 53 matches
[...everything looks happy...]

I'm not sure what the right behavior should be here, if font_parse_xlfd fails. The current behavior appears to be that the font is not added to the list being generated. With "entity" not getting filled in when the name isn't in the expected form, that's probably the right behavior at the lower level, but should the code be doing something else to get a useable name?

Ken




reply via email to

[Prev in Thread] Current Thread [Next in Thread]