summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Lam <plam@MIT.EDU>2006-02-06 14:44:46 +0000
committerPatrick Lam <plam@MIT.EDU>2006-02-06 14:44:46 +0000
commit86e75dfb5d1434837537b40e829f00f9ffbb8183 (patch)
tree60af5f46cf1db8d4c5565aacf08d0ecc697ec156
parentf076169d19574c6c548764d574a33bc4fe022ffb (diff)
Explain apples/oranges comparison and fix compilation error.
reviewed by: plam
-rw-r--r--ChangeLog7
-rw-r--r--src/fcfs.c5
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8b9c55d3..330e7687 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,13 @@
* src/fcfs.c (FcFontSetUnserialize):
+ Explain apples/oranges comparison and fix compilation error.
+
+2006-02-06 Dirk Mueller <dmueller@suse.de>
+ reviewed by: plam
+
+ * src/fcfs.c (FcFontSetUnserialize):
+
Insert check for integer overflow in # of fonts.
2006-02-04 Behdad Esfahbod <behdad@cs.toronto.edu>
diff --git a/src/fcfs.c b/src/fcfs.c
index 50049bac..cbb5dc7f 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;