[vlc-commits] FreeType: fix NULL deref on embedded fonts (fixes #7771)

Rémi Denis-Courmont git at videolan.org
Sat Nov 17 10:07:35 CET 2012


vlc/vlc-2.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov 17 11:04:12 2012 +0200| [74ff87cc141bc1b88a38ee90f95b3d935c938a56] | committer: 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)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=74ff87cc141bc1b88a38ee90f95b3d935c938a56
---

 modules/text_renderer/freetype.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c
index 5cd3ba1..622bb11 100644
--- a/modules/text_renderer/freetype.c
+++ b/modules/text_renderer/freetype.c
@@ -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) |
                                        ((p_face->style_flags & FT_STYLE_FLAG_ITALIC ) ? STYLE_ITALIC : 0);
-                if( !strcasecmp( p_face->family_name, p_style->psz_fontname ) &&
-                    (p_style->i_style_flags & (STYLE_BOLD | STYLE_ITALIC)) == i_style_received )
+                if( p_face->family_name != NULL
+                 && !strcasecmp( p_face->family_name, p_style->psz_fontname )
+                 && (p_style->i_style_flags & (STYLE_BOLD | STYLE_ITALIC))
+                                                          == i_style_received )
                     return p_face;
 
                 FT_Done_Face( p_face );



More information about the vlc-commits mailing list