Commit 74ff87cc authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

FreeType: fix NULL deref on embedded fonts (fixes #7771)

FT_Face.family_name can be NULL for embedded fonts.

See also http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_FaceRec
(cherry picked from commit d96f6e23adfd24ec188cb2a7b31cc2e992291172)
parent 7d3eba0d
...@@ -1790,8 +1790,10 @@ static FT_Face LoadEmbeddedFace( filter_sys_t *p_sys, const text_style_t *p_styl ...@@ -1790,8 +1790,10 @@ static FT_Face LoadEmbeddedFace( filter_sys_t *p_sys, const text_style_t *p_styl
{ {
int i_style_received = ((p_face->style_flags & FT_STYLE_FLAG_BOLD) ? STYLE_BOLD : 0) | int i_style_received = ((p_face->style_flags & FT_STYLE_FLAG_BOLD) ? STYLE_BOLD : 0) |
((p_face->style_flags & FT_STYLE_FLAG_ITALIC ) ? STYLE_ITALIC : 0); ((p_face->style_flags & FT_STYLE_FLAG_ITALIC ) ? STYLE_ITALIC : 0);
if( !strcasecmp( p_face->family_name, p_style->psz_fontname ) && if( p_face->family_name != NULL
(p_style->i_style_flags & (STYLE_BOLD | STYLE_ITALIC)) == i_style_received ) && !strcasecmp( p_face->family_name, p_style->psz_fontname )
&& (p_style->i_style_flags & (STYLE_BOLD | STYLE_ITALIC))
== i_style_received )
return p_face; return p_face;
FT_Done_Face( p_face ); FT_Done_Face( p_face );
......
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