[Fontconfig] Re: Yet another easy to reproduce crash in fontconfig
Mike FABIAN
mfabian at suse.de
Wed Jan 18 07:32:06 PST 2006
Mike FABIAN <mfabian at suse.de> さんは書きました:
> mfabian at magellan:~$ sudo rm /var/cache/fontconfig/*cache*
> mfabian at magellan:~$ rm .fonts.cache-2
> mfabian at magellan:~$ fc-match sans
> arial.ttf: "Arial" "Regular"
> mfabian at magellan:~$ touch .fonts.conf
> mfabian at magellan:~$ fc-match sans
> セグメンテーション違反です (core dumped)
> mfabian at magellan:~$
>
> (gdb) bt
> #0 0x00002aaaab12c420 in strlen () from /lib64/libc.so.6
> #1 0x00002aaaaabd7075 in FcGlobalCacheReadDir () from /usr/lib64/libfontconfig.so.1
The attached patch seems to fix the problem for me.
Without that patch, directories which are subdirectories of
directories listed in the config files (/etc/fonts/fonts.conf etc)
were added too late to the list of font directories in "FcConfig
*config". For example, when FcDirScanConfig() was called with the
argument "/usr/share/fonts/bdf" the list of font directories in
config->fontDirs->strs still contained only the higher level
directory "/usr/share/fonts" because only that was listed in the
config files, not the "bdf" subdirectory.
FcDirScanConfig() then calls FcGlobalCacheReadDir() before
adding the subdirectory to the list, FcGlobalCacheReadDir()
calls FcConfigNormalizeFontDir(dir) which returns 0 because the directory
is not yet in the list and then it crashes in strlen(dir) of course.
To fix this, I moved the call to FcConfigAddFontDir (config, dir)
upwards in FcDirScanConfig() to add the directory *before*
FcGlobalCacheReadDir() is called.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-dir-early-in-FcDirScanConfig.patch
Type: text/x-patch
Size: 568 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060118/daad7837/add-dir-early-in-FcDirScanConfig.bin
-------------- next part --------------
--
Mike FABIAN <mfabian at suse.de> http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。
More information about the Fontconfig
mailing list