Commit 04cedae0 authored by Keith Packard's avatar Keith Packard
Browse files

Don't segfault when string values can't be parsed as charsets or langsets.

If parsing charsets or langsets fails, return a FcTypeVoid value instead of
a charset/langset value with a NULL pointer in it (which is invalid).
parent fb6e30ab
......@@ -567,6 +567,8 @@ FcNameConvert (FcType type, FcChar8 *string, FcMatrix *m)
break;
case FcTypeString:
v.u.s = FcStrStaticName(string);
if (!v.u.s)
v.type = FcTypeVoid;
break;
case FcTypeBool:
if (!FcNameBool (string, &v.u.b))
......@@ -581,9 +583,13 @@ FcNameConvert (FcType type, FcChar8 *string, FcMatrix *m)
break;
case FcTypeCharSet:
v.u.c = FcNameParseCharSet (string);
if (!v.u.c)
v.type = FcTypeVoid;
break;
case FcTypeLangSet:
v.u.l = FcNameParseLangSet (string);
if (!v.u.l)
v.type = FcTypeVoid;
break;
default:
break;
......
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