[vlc-commits] freetype: avoid left shift of negative values

Salah-Eddin Shaban git at videolan.org
Fri Feb 5 16:23:49 CET 2016


vlc | branch: master | Salah-Eddin Shaban <salah at videolan.org> | Mon Feb  1 23:20:31 2016 +0200| [4b983bd74c1390f99c31c71fd575932a31ec39f8] | committer: Jean-Baptiste Kempf

freetype: avoid left shift of negative values

Close #16484

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

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

diff --git a/modules/text_renderer/freetype/text_layout.c b/modules/text_renderer/freetype/text_layout.c
index f302e9d..a8c8610 100644
--- a/modules/text_renderer/freetype/text_layout.c
+++ b/modules/text_renderer/freetype/text_layout.c
@@ -1495,6 +1495,13 @@ int LayoutText( filter_t *p_filter, line_desc_t **pp_lines,
              * and any extra width caused by visual reordering
              */
             int i_max_width = ( int ) p_filter->fmt_out.video.i_visible_width - i_max_advance_x;
+
+            if( i_max_width <= 0 )
+            {
+                msg_Err( p_filter, "LayoutText(): Invalid max width" );
+                goto error;
+            }
+
             if( LayoutParagraph( p_filter, p_paragraph,
                                  i_max_width, pp_line, b_grid ) )
                 goto error;



More information about the vlc-commits mailing list