[Fontconfig] Crash in fc-cat CVS

Frederic Crozat fcrozat at mandriva.com
Wed Jan 11 08:07:49 PST 2006


with CVs from today (2005-01-11), I'm able to trigger an easy crash with
fc-cat. To reproduce :
make sure you have an empty sub-directory in your fonts path
rm -rf /var/cache/fontconfig/*
xterm -fa sans
fc-cat ~/.fonts.cache-2

fc-cat will crash with the following stacktrace, when trying to print
info for the empty directory :

fc-cat: printing global cache contents for
dir /usr/X11R6/lib/X11/fonts/mdk

Program received signal SIGSEGV, Segmentation fault.
0xb7ed1a6b in FcConfigAddFontDir (config=0x0, d=0x0) at fccfg.c:388
388         return FcStrSetAddFilename (config->fontDirs, d);
(gdb) bt
#0  0xb7ed1a6b in FcConfigAddFontDir (config=0x0, d=0x0) at fccfg.c:388
#1  0x0804a19c in FcDirCacheConsume (fd=7,
    dir=0xbf82dae7 "/usr/X11R6/lib/X11/fonts/mdk", set=0x8051008,
    at ../src/fccache.c:972
#2  0x0804bbea in main (argc=2, argv=0xbf830bf4) at fc-cat.c:205
#3  0xb7bcbe40 in __libc_start_main () from /lib/tls/libc.so.6
#4  0x08049a61 in _start () at ../sysdeps/i386/elf/start.S:119

I'm not sure how to fix this cleanly : either handle null config in
FcConfigAddFontDir nicely or prevent the call in FcDirCacheConsume.

Frederic Crozat <fcrozat at mandriva.com>

More information about the Fontconfig mailing list