[Fontconfig] FcFontList() can return NULL - should it? should it be documented?

Alan Coopersmith alan.coopersmith at oracle.com
Mon Aug 29 05:31:01 UTC 2016

On 08/24/16 11:48 PM, Alan Coopersmith wrote:
> On 08/24/16 11:27 PM, Akira TAGOH wrote:
>> Can you investigate more where the checking failed and then return NULL in
>> fontconfig? and what version of fontconfig are you using?
> It was reported when we were shipping 2.11.94 - we upgraded to 2.12.1 earlier
> this month, and I don't know if it affects that version.
> Now that we know this isn't expected, I'll try to find time soon to dig deeper
> to see where the failure bubbles up from, since I see several possible paths
> in the code that can return NULL if other functions do.

Okay, I spent some time on this tonight in a fresh VM.

I could reproduce with our previous 2.11.94 packages, but not 2.12.1.

I built debuggable binaries and stepped through in the debugger - 2.12.1
returned a valid pointer from FcFontList, but with 2.11.94 FcFontList instead
returned NULL, because FcConfigAddDirList did not find any caches and thus
never set ret = FcTrue in it's while loop, which then bubbled up the stack
as a failure through:

=>[1] FcConfigAddDirList(config = 0x505740, set = FcSetSystem, dirSet = 
0x502ff0), line 389 in "fccfg.c"
   [2] FcConfigBuildFonts(config = 0x505740), line 415 in "fccfg.c"
   [3] FcInitLoadOwnConfigAndFonts(config = 0x505740), line 163 in "fcinit.c"
   [4] FcInitLoadConfigAndFonts(), line 174 in "fcinit.c"
   [5] FcConfigEnsure(), line 46 in "fccfg.c"
   [6] FcConfigGetCurrent(), line 450 in "fccfg.c"
   [7] FcInitBringUptoDate(), line 223 in "fcinit.c"
   [8] FcFontList(config = (nil), p = 0x502f30, os = 0x504740), line 593 in 
   [9] main(argc = 1, argv = 0xffff80ffbffff838), line 162 in "fc-list.c"

So I think I've just rediscovered why your fix was necessary in:
and can be glad the upgrade I already did to 2.12.1 solved it - thanks.

	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc

More information about the Fontconfig mailing list