Commit 07e646cc authored by Mike FABIAN's avatar Mike FABIAN Committed by Keith Packard
Browse files

Avoid crashes if config files contain junk.

If ~/.fonts.conf contains:

  <edit mode="assign_replace" name="spacing">

fontconfig crashes:

    mfabian@magellan:~$ fc-match sans
        Fontconfig error: "~/.fonts.conf", line 46: "mono": not a valid
	    セグメンテーション違反です (core dumped)

Of course the above is nonsense, “mono” is no valid integer indeed.

But I think nevertheless fontconfig should not crash in that case.

The problem was caused by partially truncated expression trees caused by
parse errors -- typechecking these walked the tree without verifying the
integrity of the structure. Of course, the whole tree will be discarded
shortly after being loaded as it contained an error.
parent fa9a7448
......@@ -558,6 +558,10 @@ FcTypecheckExpr (FcConfigParse *parse, FcExpr *expr, FcType type)
const FcObjectType *o;
const FcConstant *c;
/* If parsing the expression failed, some nodes may be NULL */
if (!expr)
switch (expr->op) {
case FcOpInteger:
case FcOpDouble:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment