[Fontconfig] Re: [PATCH] fix crashes on malformed fonts.cache
Dirk Mueller
dmueller at suse.de
Mon Feb 6 06:46:01 PST 2006
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;
More information about the Fontconfig
mailing list