[vlc-devel] [PATCH 09/11] Fix segfault of the font name is null.

Devin Heitmueller dheitmueller at kernellabs.com
Thu Dec 27 07:08:21 CET 2012


There can be cases where the font matching criteria matches but the
font name is null.  Don't call strdup() against a NULL pointer.
---
 modules/text_renderer/freetype.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c
index c9b8025..bb9ded4 100644
--- a/modules/text_renderer/freetype.c
+++ b/modules/text_renderer/freetype.c
@@ -1535,7 +1535,8 @@ static int HandleTT(font_stack_t **p_fonts, const char *p_fontfamily )
                                  &i_font_color,
                                  &i_karaoke_bg_color ))
     {
-        psz_fontname = strdup( psz_fontname );
+        if (psz_fontname)
+            psz_fontname = strdup( psz_fontname );
     }
     i_font_alpha = (i_font_color >> 24) & 0xff;
     i_font_color &= 0x00ffffff;
-- 
1.7.9.5




More information about the vlc-devel mailing list