fontconfig中的BUG
最近发现fontconfig中有个BUG导致打开KDE控制中心字体安装程序异常退出。BUG在 fontconfig-2.2.3/src/fccfg.c中
void
FcConfigAppFontClear (FcConfig *config)
{
FcConfigSetFonts (config, 0, FcSetApplication);
}
void
FcConfigSetFonts (FcConfig *config,
FcFontSet *fonts,
FcSetName set)
{
if (config->fonts)
FcFontSetDestroy (config->fonts);
/*---------------------------------------------------------*/
/* Add by Firefly([email protected]) */
#define ST_ITALIC 0
#define ST_BOLD 1
#define ST_BOLD_ITALIC 2
FcBool scalable;
FcPattern *pat;
FcChar8 *family;
int slant, weight;
int f;
for (f = 0; f < fonts->nfont; f++) //BUG: FcConfigSetFonts (config, 0, FcSetApplication);这里 fonts为0 空指针错误!
{
.......
};
解决方法:
void
FcConfigSetFonts (FcConfig *config,
FcFontSet *fonts,
FcSetName set)
{
if (config->fonts)
FcFontSetDestroy (config->fonts);
/*---------------------------------------------------------*/
/* Add by Firefly([email protected]) */
#define ST_ITALIC 0
#define ST_BOLD 1
#define ST_BOLD_ITALIC 2
FcBool scalable;
FcPattern *pat;
FcChar8 *family;
int slant, weight;
int f;
if (fonts == 0) { //在这里加fonts值的判断
config->fonts = fonts;
return;
}
for (f = 0; f < fonts->nfont; f++)
{
.......
}; 原来如些 :) 已修正,并打上了firefly的允许1%漏字的补丁,请在下面下载:
http://www.magiclinux.org/people/kanker/os/rpms/fontconfig-2.2.3-8mgc.i686.rpm
http://www.magiclinux.org/people/kanker/os/rpms/fontconfig-devel-2.2.3-8mgc.i686.rpm
源码包:
http://www.magiclinux.org/people/kanker/os/srpms/fontconfig-2.2.3-8mgc.src.rpm
页:
[1]