[Fontconfig] Re: Crash when non-existing directories are referenced in ~/.fonts.cache

Mike FABIAN mfabian at suse.de
Thu Jan 26 09:55:18 PST 2006


The following code in FcConfigNormalizeFontDir ()

     /* Ok, we didn't find it in fontDirs; let's add subdirs.... */
     for (n = 0; n < config->fontDirs->num; n++)
 	FcConfigAddFontDirSubdirs (config, config->fontDirs->strs[n]);

adds the same subdirectories many times because 
config->fontDirs->num is getting bigger during the for loop.

This causes many unnecessary opendir() and readdir() calls.

I think one should end the for loop when the initial value of
config->fontDirs->num is reached. All values in the list after the
initial value of num are newly added subdirectories, there is no
reason to scan them for subdirectories again.

Patch attached.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nmax.patch
Type: text/x-patch
Size: 775 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060126/642407c8/nmax.bin
-------------- next part --------------

-- 
Mike FABIAN   <mfabian at suse.de>   http://www.suse.de/~mfabian
?????????????


More information about the Fontconfig mailing list