This patch was suggested by Akira TAGOH in the following bug report.
https://bugs.freedesktop.org/show_bug.cgi?id=103237
I made TIZEN_ONLY comments because it is not applied in upstream yet.
@tizen_fix
Change-Id: I261a3ae2f6abc37173a861a7cbef48ba68a19fb9
FcValueListPtr l;
char *last_offset;
+ /* TIZEN_ONLY(20171013): Add a condition to FcCacheOffsetsValid() for detecting empty data of cache
if ((char *) font < base ||
(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))
return FcFalse;
+ */
+ if ((char *) font < base ||
+ (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) ||
+ !FcRefIsConst (&font->ref))
+ return FcFalse;
+ /* END */
e = FcPatternElts(font);