Fix a crash with invalid matrix element

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/140
This commit is contained in:
Akira TAGOH 2019-01-23 05:59:24 +00:00
parent b047e29954
commit 699d6e4d84
1 changed files with 5 additions and 0 deletions

View File

@ -1480,6 +1480,11 @@ FcParseMatrix (FcConfigParse *parse)
m.xy = FcPopExpr (parse);
m.xx = FcPopExpr (parse);
if (!m.yy || !m.yx || !m.xy || !m.xx)
{
FcConfigMessage (parse, FcSevereWarning, "Missing values in matrix element");
return;
}
if (FcPopExpr (parse))
FcConfigMessage (parse, FcSevereError, "wrong number of matrix elements");
else