Missing NULL font check before attempting to edit scanned pattern.
Also, <match target="scan"> rules are now checked to ensure all
edited variables are in the predefined set; otherwise, the resulting
cache files will not be stable.
/*
* Edit pattern with user-defined rules
*/
- if (config && !FcConfigSubstituteWithPat (config, font, NULL, FcMatchScan))
+ if (font && config && !FcConfigSubstituteWithPat (config, font, NULL, FcMatchScan))
{
FcPatternDestroy (font);
font = NULL;
#define FC_EMBOLDEN_OBJECT 38
#define FC_EMBEDDED_BITMAP_OBJECT 39
#define FC_DECORATIVE_OBJECT 40
+#define FC_MAX_BASE_OBJECT FC_DECORATIVE_OBJECT
FcPrivate FcBool
FcNameBool (const FcChar8 *v, FcBool *result);
vstack->u.edit->next = edit;
edit = vstack->u.edit;
vstack->tag = FcVStackNone;
+ if (kind == FcMatchScan && edit->object > FC_MAX_BASE_OBJECT)
+ {
+ FcConfigMessage (parse, FcSevereError,
+ "<match target=\"scan\"> cannot edit user-defined object \"%s\"",
+ FcObjectName(edit->object));
+ }
break;
default:
FcConfigMessage (parse, FcSevereWarning, "invalid match element");