From eadadf489aff5f4a17a91f85909cb0dc27b2a494 Mon Sep 17 00:00:00 2001 From: Patrick Lam Date: Sun, 15 Jan 2006 05:31:58 +0000 Subject: [PATCH] Fix segfault when consuming zero-length caches in fc-cat (which has no config, so FcConfigAddFontDir shouldn't be called.) --- ChangeLog | 6 ++++++ src/fccache.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a09abf5..8bcf9fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-01-14 Patirck Lam + * 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 * fc-cache/fc-cache.c (scanDirs): * fontconfig/fontconfig.h: diff --git a/src/fccache.c b/src/fccache.c index b36dbd2..10e65dd 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -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; } -- 2.39.5