From: Erwan Tulou Date: Wed, 14 Sep 2011 15:13:50 +0000 (+0200) Subject: freetype: fix crash X-Git-Tag: 1.2.0-pre1~730 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=533090db4c9c616649b449b3ad6d5743b920da5a;p=vlc freetype: fix crash shadow and outline must be reset to NULL if the freetype call fails, so that the same memory is not deallocated twice later on. --- diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c index bf32c825b7..aadb9c58fd 100644 --- a/modules/text_renderer/freetype.c +++ b/modules/text_renderer/freetype.c @@ -1759,15 +1759,22 @@ static int GetGlyph( filter_t *p_filter, if( p_filter->p_sys->p_stroker ) { outline = glyph; - FT_Glyph_StrokeBorder( &outline, p_filter->p_sys->p_stroker, 0, 0 ); + if( FT_Glyph_StrokeBorder( &outline, p_filter->p_sys->p_stroker, 0, 0 ) ) + outline = NULL; } FT_Glyph shadow = NULL; if( p_filter->p_sys->i_shadow_opacity > 0 ) { shadow = outline ? outline : glyph; - FT_Glyph_To_Bitmap( &shadow, FT_RENDER_MODE_NORMAL, p_pen_shadow, 0 ); - FT_Glyph_Get_CBox( shadow, ft_glyph_bbox_pixels, p_shadow_bbox ); + if( FT_Glyph_To_Bitmap( &shadow, FT_RENDER_MODE_NORMAL, p_pen_shadow, 0 ) ) + { + shadow = NULL; + } + else + { + FT_Glyph_Get_CBox( shadow, ft_glyph_bbox_pixels, p_shadow_bbox ); + } } *pp_shadow = shadow;