[Fontconfig] FcFini blows up on Ubuntu 12.04.1 LTS

mathog mathog at caltech.edu
Fri Sep 28 15:21:08 PDT 2012

The small attached program blows up in FcFini() when it is run on 
Ubuntu 12.04.1 LTS.  It does not explode
on Mingw.  On Ubuntu built it like:

gcc -Wall -g -I/usr/include/freetype2 -o ft_example ft_example.c 
-lfreetype -lfontconfig

The mode of failure is:

gdb ./ft_example
letter:r advance = 1408
letter:l advance = 960
letter:d advance = 2368
ft_example: fccache.c:507: FcCacheFini: Assertion `fcCacheChains[i] == 
((void *)0)' failed.

Program received signal SIGABRT, Aborted.
0x00132416 in __kernel_vsyscall ()
(gdb) bt
#0  0x00132416 in __kernel_vsyscall ()
#1  0x0022f1ef in __GI_raise (sig=6) at 
#2  0x00232835 in __GI_abort () at abort.c:91
#3  0x00228095 in __assert_fail_base (fmt=0x3618b8 "%s%s%s:%u: 
%s%sAssertion `%s' failed.\n%n", assertion=0x1ec300 "fcCacheChains[i] == 
((void *)0)",
     file=0x1ec347 "fccache.c", line=507, function=0x1ec382 
"FcCacheFini") at assert.c:94
#4  0x00228147 in __GI___assert_fail (assertion=0x1ec300 
"fcCacheChains[i] == ((void *)0)", file=0x1ec347 "fccache.c", line=507,
     function=0x1ec382 "FcCacheFini") at assert.c:103
#5  0x001d2bae in ?? () from /usr/lib/i386-linux-gnu/libfontconfig.so.1
#6  0x001df3bb in FcFini () from 
#7  0x08048d2f in main () at ft_example.c:127

When run under valgrind

valgrind --leak-check=yes  --show-reachable=yes  ./ft_example >vg.log 

there are multiple invalid reads before the printf's in the test 
program and the leak summary is:

==10745== LEAK SUMMARY:
==10745==    definitely lost: 640 bytes in 2 blocks
==10745==    indirectly lost: 3,100 bytes in 154 blocks
==10745==      possibly lost: 0 bytes in 0 blocks
==10745==    still reachable: 64 bytes in 3 blocks
==10745==         suppressed: 0 bytes in 0 blocks

Software Version info:
ubuntu 12.04.1 LTS
gcc 4.6.3
libfontconfig 2.8.0-3ubuntu9.1  (also tried building fontconfig 2.10.1 
and linking to that, same problem)
libfreetype6  2.4.8-1ubuntu2    (probably irrelevant, all of the FT 
parts could be removed with an #if 0
   and FcFini() still blew up.

Both the mingw and Ubuntu machines were running on the same type of 
hardware, using AMD Athlon II X2 245

Does this issue look familiar?  Suggestions?  The function that this 
will go into needs to be absolutely clean when
run inside valgrind.  The function will eventually be going into 
Inkscape, which is already painful to use with valgrind,
and more spurious memory warnings must be avoided like the plague.  
And, of course, the crash on FcFini() is
really a problem.

Thank you,

David Mathog
mathog at caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ft_example.c
Type: text/x-c
Size: 3660 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20120928/c65a1706/attachment.bin>

More information about the Fontconfig mailing list