[Fontconfig] fontconfig crash for special bdf font

Werner LEMBERG wl at gnu.org
Tue Jan 28 23:09:23 PST 2014


> That prop.u.atom is the result of calling FT_BDF_Get_Property
> though, we are expecting to see the proper atom when prop.type is
> set to BDF_PROPERTY_TYPE_ATOM.  In this case IMHO prop.type should
> be set to BDF_PROPERTY_TYPE_NONE and returns an error.

Why?  The entry in the font causing the crash is is

  SETWIDTH_NAME ""

which is valid from a syntax point of view AFAICS, so returning an
error seems incorrect to me.

However: There is explicit code in FreeType's BDF handling which
prevents the creation of an empty string (cf. bdflib.c, line 1394),
thus NULL is a valid value for `prop.u.atom'.  Looking up the code I
see that this is a change from 2007, and before that change FreeType
indeed returned an empty string...

I see two possibilities on the FreeType side:

  1. Document that NULL is a valid return value for `atom',
     corresponding to a property present in the font with a zero
     string as an argument – the return value
     `FT_Err_Invalid_Argument' of function `FT_Get_BDF_Property'
     indicates that the searched property isn't present in the font.

  2. Change the code back to return an empty string.

I tend to solution 1, but I'm open to other suggestions.


    Werner


More information about the Fontconfig mailing list