]> git.sesse.net Git - vlc/commitdiff
Fixed a segfault when trying to render a unbreakable string.
authorLaurent Aimar <fenrir@videolan.org>
Wed, 17 Sep 2008 18:24:34 +0000 (20:24 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 17 Sep 2008 18:36:56 +0000 (20:36 +0200)
modules/misc/freetype.c

index f716b99bdd9aa5fd9d953923d75c30ade4abbfcf..c5864307b3efd9a586cf5240ee367fbc0f95b98d 100644 (file)
@@ -1726,10 +1726,9 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
                     glyph_size.xMin + ((FT_BitmapGlyph)tmp_glyph)->left;
         if( line.xMax > (int)p_filter->fmt_out.video.i_visible_width - 20 )
         {
-            while( --i > *pi_start )
-            {
+            for( ; i >= *pi_start; i-- )
                 FT_Done_Glyph( (FT_Glyph)p_line->pp_glyphs[ i ] );
-            }
+            i = *pi_start;
 
             while( psz_unicode > psz_unicode_start && *psz_unicode != ' ' )
             {
@@ -1753,8 +1752,6 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
                 p_result->x = __MAX( p_result->x, line.xMax );
                 p_result->y = __MAX( p_result->y, __MAX( p_line->i_height,
                                                          i_yMax - i_yMin ) );
-
-                *pi_start = i;
                 return VLC_SUCCESS;
             }
             else