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).
This commit is contained in:
Keith Packard 2006-09-02 20:23:31 -07:00
parent fb6e30ab3e
commit 04cedae0d5
1 changed files with 6 additions and 0 deletions

View File

@ -567,6 +567,8 @@ FcNameConvert (FcType type, FcChar8 *string, FcMatrix *m)
break; break;
case FcTypeString: case FcTypeString:
v.u.s = FcStrStaticName(string); v.u.s = FcStrStaticName(string);
if (!v.u.s)
v.type = FcTypeVoid;
break; break;
case FcTypeBool: case FcTypeBool:
if (!FcNameBool (string, &v.u.b)) if (!FcNameBool (string, &v.u.b))
@ -581,9 +583,13 @@ FcNameConvert (FcType type, FcChar8 *string, FcMatrix *m)
break; break;
case FcTypeCharSet: case FcTypeCharSet:
v.u.c = FcNameParseCharSet (string); v.u.c = FcNameParseCharSet (string);
if (!v.u.c)
v.type = FcTypeVoid;
break; break;
case FcTypeLangSet: case FcTypeLangSet:
v.u.l = FcNameParseLangSet (string); v.u.l = FcNameParseLangSet (string);
if (!v.u.l)
v.type = FcTypeVoid;
break; break;
default: default:
break; break;