[vlc-devel] [PATCH] text_renderer/freetype: Fix uninitialized usage of i_max_face_height

Marvin Scholz epirat07 at gmail.com
Thu Mar 29 11:38:28 CEST 2018


---
 modules/text_renderer/freetype/freetype.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/modules/text_renderer/freetype/freetype.c b/modules/text_renderer/freetype/freetype.c
index bf76d49b0c..8d485bd65f 100644
--- a/modules/text_renderer/freetype/freetype.c
+++ b/modules/text_renderer/freetype/freetype.c
@@ -1229,13 +1229,6 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
     else if( p_region_in->i_y > 0 && (unsigned)p_region_in->i_y < i_max_height )
         i_max_height -= p_region_in->i_y;
 
-    uint8_t i_background_opacity = var_InheritInteger( p_filter, "freetype-background-opacity" );
-    i_background_opacity = VLC_CLIP( i_background_opacity, 0, 255 );
-    int i_margin = (i_background_opacity > 0 && !p_region_in->b_gridmode) ? i_max_face_height / 4 : 0;
-
-    if( (unsigned)i_margin * 2 >= i_max_width || (unsigned)i_margin * 2 >= i_max_height )
-        i_margin = 0;
-
     text_block.i_max_width = i_max_width;
     text_block.i_max_height = i_max_height;
     rv = LayoutTextBlock( p_filter, &text_block, &text_block.p_laid, &bbox, &i_max_face_height );
@@ -1247,6 +1240,13 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
         const vlc_fourcc_t p_chroma_list_yuvp[] = { VLC_CODEC_YUVP, 0 };
         const vlc_fourcc_t p_chroma_list_rgba[] = { VLC_CODEC_RGBA, 0 };
 
+        uint8_t i_background_opacity = var_InheritInteger( p_filter, "freetype-background-opacity" );
+        i_background_opacity = VLC_CLIP( i_background_opacity, 0, 255 );
+        int i_margin = (i_background_opacity > 0 && !p_region_in->b_gridmode) ? i_max_face_height / 4 : 0;
+
+        if( (unsigned)i_margin * 2 >= i_max_width || (unsigned)i_margin * 2 >= i_max_height )
+            i_margin = 0;
+
         if( var_InheritBool( p_filter, "freetype-yuvp" ) )
             p_chroma_list = p_chroma_list_yuvp;
         else if( !p_chroma_list || *p_chroma_list == 0 )
-- 
2.14.3 (Apple Git-98)



More information about the vlc-devel mailing list