patch: destroy ~/.fonts.cache-2 if it doesn't start with FC_GLOBAL_MAGIC_COOKIE or no string can be read at all from that file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A colleague again had a problem with a apparently broken
~/.fonts.cache-2 file. The file is here:

http://lisa.goe.net/~mfabian/.fonts.cache-2-T42p-JP

The file is huge (78 Megabytes) and apparently broken, as it doesn't
start with FC_GLOBAL_MAGIC_COOKIE.

When calling

    fc-match sans

this took a lot of time *always* the broken file was never fixed.
Actually it grew bigger and bigger all the time.

I believe if FcGlobalCacheLoad () cannot read any string at all from
~/.fonts.cache-2 or if the file does not start with
FC_GLOBAL_MAGIC_COOKIE it should exit with "goto bail_and_destroy;" to
delete the broken file instead of just "return;".

diff -ru fontconfig-2.3.93.20060130.orig/src/fccache.c fontconfig-2.3.93.20060130/src/fccache.c
--- fontconfig-2.3.93.20060130.orig/src/fccache.c	2006-01-30 17:54:22.000000000 +0100
+++ fontconfig-2.3.93.20060130/src/fccache.c	2006-01-30 20:24:25.000000000 +0100
@@ -219,9 +219,9 @@
     cache->updated = FcFalse;
 
     if (!FcCacheReadString (cache->fd, name_buf, sizeof (name_buf)))
-	return;
+	goto bail_and_destroy;
     if (strcmp (name_buf, FC_GLOBAL_MAGIC_COOKIE) != 0)
-	return;
+	goto bail_and_destroy;
 
     current_arch_machine_name = FcCacheMachineSignature ();
     current_arch_start = FcCacheSkipToArch(cache->fd, 
-- 
Mike FABIAN   <mfabian@xxxxxxx>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux