From: Keith Packard Date: Sun, 3 Sep 2006 03:23:31 +0000 (-0700) Subject: Don't segfault when string values can't be parsed as charsets or langsets. X-Git-Tag: 2.3.96~5 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=04cedae0d5a720662bdc0de3d4cb97f6c77e7d1a;p=fontconfig.git 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). --- diff --git a/src/fcname.c b/src/fcname.c index 6f74bb1..cfc6b31 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -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;