[vlc-devel] [PATCH] Fix segfault which can occur if a subdecoder provides a null font name

Devin Heitmueller dheitmueller at kernellabs.com
Tue Jan 1 22:48:45 CET 2013


Use the system font if the style is explicitly specified but the font
name is null.

This addresses a segfault introduced during commit
75402b8f25030fff192738b462e985933be0360c
---
 modules/text_renderer/freetype.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c
index eec6967..ac94c62 100644
--- a/modules/text_renderer/freetype.c
+++ b/modules/text_renderer/freetype.c
@@ -1610,6 +1610,10 @@ static int ProcessNodes( filter_t *p_filter,
 
     if( p_font_style )
     {
+        /* If the font is not specified in the style, assume the system font */
+        if(!p_font_style->psz_fontname)
+             p_font_style->psz_fontname = strdup(p_sys->psz_fontfamily);
+
         rv = PushFont( &p_fonts,
                p_font_style->psz_fontname,
                p_font_style->i_font_size > 0 ? p_font_style->i_font_size
-- 
1.7.9.5




More information about the vlc-devel mailing list