[vlc-commits] freetype: handle freeing bitmap glyphs

Francois Cartegnie git at videolan.org
Tue Jul 7 20:34:06 CEST 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jun 30 13:14:03 2020 +0200| [d088e548b20d9d0c220ea973c71ffbc891551aac] | committer: Francois Cartegnie

freetype: handle freeing bitmap glyphs

Currently double free is only prevented by
FT_Set_Pixel_Sizes error on pure bitmaps.

FT_LOAD_NO_BITMAP does not exclude bitmap only fonts
and FT_Glyph_To_Bitmap is no-op for bitmap fonts,
shadow glyph pointer can then end pointing to same
glyph as main glyph.

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

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

diff --git a/modules/text_renderer/freetype/text_layout.c b/modules/text_renderer/freetype/text_layout.c
index 057d787374..7a496bde7e 100644
--- a/modules/text_renderer/freetype/text_layout.c
+++ b/modules/text_renderer/freetype/text_layout.c
@@ -171,7 +171,7 @@ static void FreeLine( line_desc_t *p_line )
         FT_Done_Glyph( (FT_Glyph)ch->p_glyph );
         if( ch->p_outline )
             FT_Done_Glyph( (FT_Glyph)ch->p_outline );
-        if( ch->p_shadow )
+        if( ch->p_shadow && ch->p_shadow != ch->p_glyph )
             FT_Done_Glyph( (FT_Glyph)ch->p_shadow );
     }
 
@@ -1255,7 +1255,7 @@ static int LayoutLine( filter_t *p_filter,
                 FT_Done_Glyph( p_bitmaps->p_glyph );
                 if( p_bitmaps->p_outline )
                     FT_Done_Glyph( p_bitmaps->p_outline );
-                if( p_bitmaps->p_shadow )
+                if( p_bitmaps->p_shadow != p_bitmaps->p_glyph )
                     FT_Done_Glyph( p_bitmaps->p_shadow );
                 continue;
             }



More information about the vlc-commits mailing list