From 530e66b008c0d5b972b54046a5b15e76c8e989b6 Mon Sep 17 00:00:00 2001 From: Patrick Lam Date: Sat, 18 Feb 2006 18:18:07 +0000 Subject: [PATCH] Fix the underlying cause of the below segfault (must usually call FcDirCacheHasCurrentArch after FcDirCacheValid). --- ChangeLog | 12 ++++++++++-- fc-cache/fc-cache.c | 2 ++ src/fccache.c | 4 +++- src/fcdir.c | 4 +++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 840a372..737db03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,16 @@ +2006-02-18 Patrick Lam + * fc-cache/fc-cache.c (scanDirs): + * src/fccache.c (FcCacheReadDirs): + * src/fcdir.c (FcDirScanConfig): + + Fix the underlying cause of the below segfault (must usually + call FcDirCacheHasCurrentArch after FcDirCacheValid). + 2006-02-18 Patrick Lam * src/fccache.c (FcDirCacheHasCurrentArch): - Fix segfault (reported by fcrozat) caused by incorrect - input on cache files. + Fix triggering of segfault caused by misreading cache files + (reported by fcrozat). 2006-02-17 Patrick Lam * src/fcint.h (FC_CACHE_MAGIC): diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c index b80d416..ba1ba2b 100644 --- a/fc-cache/fc-cache.c +++ b/fc-cache/fc-cache.c @@ -234,6 +234,8 @@ scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool printf ("caching, %d fonts, %d dirs\n", set->nfont, nsubdirs (subdirs)); + /* This is the only reason we can't combine + * Valid w/HasCurrentArch... */ if (!FcDirCacheValid (dir)) if (!FcDirCacheUnlink (dir, config)) ret++; diff --git a/src/fccache.c b/src/fccache.c index da4abc7..98f0a88 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -931,7 +931,9 @@ FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache, FcStrSetDestroy (subdirs); continue; } - if (FcDirCacheValid (dir) && FcDirCacheRead (set, subdirs, dir, config)) + if (FcDirCacheValid (dir) && + FcDirCacheHasCurrentArch (dir) && + FcDirCacheRead (set, subdirs, dir, config)) { /* if an old entry is found in the global cache, disable it */ if ((d = FcGlobalCacheDirFind (cache, (const char *)dir)) != NULL) diff --git a/src/fcdir.c b/src/fcdir.c index 771c09b..18cb6cc 100644 --- a/src/fcdir.c +++ b/src/fcdir.c @@ -142,7 +142,9 @@ FcDirScanConfig (FcFontSet *set, if (cache && FcGlobalCacheReadDir (set, dirs, cache, (char *)dir, config)) return FcTrue; - if (FcDirCacheValid (dir) && FcDirCacheRead (set, dirs, dir, config)) + if (FcDirCacheValid (dir) && + FcDirCacheHasCurrentArch (dir) && + FcDirCacheRead (set, dirs, dir, config)) return FcTrue; }