Fix segfault when consuming zero-length caches in fc-cat (which has no

config, so FcConfigAddFontDir shouldn't be called.)
This commit is contained in:
Patrick Lam 2006-01-15 05:31:58 +00:00
parent 8a0b0ed6d0
commit eadadf489a
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2006-01-14 Patirck Lam <plam@mit.edu>
* src/fccache.c (FcDirCacheConsume):
Fix segfault when consuming zero-length caches in fc-cat
(which has no config, so FcConfigAddFontDir shouldn't be called.)
2006-01-14 Patrick Lam <plam@mit.edu>
* fc-cache/fc-cache.c (scanDirs):
* fontconfig/fontconfig.h:

View File

@ -978,7 +978,8 @@ FcDirCacheConsume (int fd, const char * dir, FcFontSet *set, FcConfig *config)
{
pos = FcCacheNextOffset (lseek(fd, 0, SEEK_CUR));
lseek (fd, pos, SEEK_SET);
FcConfigAddFontDir (config, (FcChar8 *)dir);
if (config)
FcConfigAddFontDir (config, (FcChar8 *)dir);
return FcTrue;
}