Re: [PATCH] fix crashes on malformed fonts.cache

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

 



On Monday 06 February 2006 15:17, Patrick Lam wrote:

> Yes, this is much better.  I've committed it.

Thanks. On second thought (sorry ;)), this would be better (also, it even 
compiles, wow!): 


Dirk


Index: fcfs.c
===================================================================
RCS file: /cvs/fontconfig/fontconfig/src/fcfs.c,v
retrieving revision 1.4.4.10
diff -u -3 -d -p -r1.4.4.10 fcfs.c
--- fcfs.c	6 Feb 2006 14:14:21 -0000	1.4.4.10
+++ fcfs.c	6 Feb 2006 14:40:27 -0000
@@ -159,7 +159,10 @@ FcFontSetUnserialize(FcCache * metadata,
     nfont = *(int *)block_ptr;
     block_ptr = (int *)block_ptr + 1;
 
-    if (nfont > 0 && nfont < metadata.count)
+    /* comparing nfont and metadata.count is a bit like comparing
+       apples and oranges. Its just for rejecting totally insane
+       nfont values, and for that its good enough */
+    if (nfont > 0 && nfont < metadata->count / sizeof(void*))
     {
 	FcPattern * p = (FcPattern *)block_ptr;
 
_______________________________________________
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