summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2017-11-14 20:55:24 +0900
committerAkira TAGOH <akira@tagoh.org>2017-11-14 20:59:27 +0900
commit665584a19b0ec227c93643ffb0540d11ac8ecf7f (patch)
tree1e25f5ea6c5edbe9c83c8a45e28d9f0588763f14
parentbc0240bf12ea419c7c806575de43bb903f150e49 (diff)
downloadfontconfig-fc-2-12.tar.gz
Validate cache more carefullyfc-2-12
Reject caches when FcPattern isn't a constant. This is usually unlikely to happen but reported. I've decided to add more validation since this isn't reproducible and easy to have a workaround rather than investigating 'why'. https://bugs.freedesktop.org/show_bug.cgi?id=103237
-rw-r--r--src/fccache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fccache.c b/src/fccache.c
index 6f3c68a..c59ea19 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -646,7 +646,8 @@ FcCacheOffsetsValid (FcCache *cache)
(char *) font > end - sizeof (FcFontSet) ||
font->elts_offset < 0 ||
font->elts_offset > end - (char *) font ||
- font->num > (end - (char *) font - font->elts_offset) / sizeof (FcPatternElt))
+ font->num > (end - (char *) font - font->elts_offset) / sizeof (FcPatternElt) ||
+ !FcRefIsConst (&font->ref))
return FcFalse;