From 86e75dfb5d1434837537b40e829f00f9ffbb8183 Mon Sep 17 00:00:00 2001 From: Patrick Lam Date: Mon, 6 Feb 2006 14:44:46 +0000 Subject: [PATCH] Explain apples/oranges comparison and fix compilation error. reviewed by: plam --- ChangeLog | 7 +++++++ src/fcfs.c | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8b9c55d..330e768 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-02-06 Dirk Mueller + reviewed by: plam + + * src/fcfs.c (FcFontSetUnserialize): + + Explain apples/oranges comparison and fix compilation error. + 2006-02-06 Dirk Mueller reviewed by: plam diff --git a/src/fcfs.c b/src/fcfs.c index 50049ba..cbb5dc7 100644 --- a/src/fcfs.c +++ b/src/fcfs.c @@ -159,7 +159,10 @@ FcFontSetUnserialize(FcCache * metadata, FcFontSet * s, void * block_ptr) 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; -- 2.39.2