[vlc-commits] freetype: check fribidi return code

Francois Cartegnie git at videolan.org
Thu Sep 10 23:11:31 CEST 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Aug 13 13:54:56 2020 +0200| [2f7319fb148bafcb3560880792675124565eebd3] | committer: Francois Cartegnie

freetype: check fribidi return code

(cherry picked from commit 398dc973b02225af7e9eb257d9b6e676c8e367a2)

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

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

diff --git a/modules/text_renderer/freetype/text_layout.c b/modules/text_renderer/freetype/text_layout.c
index 243a7f717a..ca9ccb83bc 100644
--- a/modules/text_renderer/freetype/text_layout.c
+++ b/modules/text_renderer/freetype/text_layout.c
@@ -374,6 +374,7 @@ static void FreeParagraph( paragraph_t *p_paragraph )
 #ifdef HAVE_FRIBIDI
 static int AnalyzeParagraph( paragraph_t *p_paragraph )
 {
+    int i_max;
     fribidi_get_bidi_types(  p_paragraph->p_code_points,
                              p_paragraph->i_size,
                              p_paragraph->p_types );
@@ -382,17 +383,21 @@ static int AnalyzeParagraph( paragraph_t *p_paragraph )
                                p_paragraph->i_size,
                                p_paragraph->p_types,
                                p_paragraph->p_btypes );
-    fribidi_get_par_embedding_levels_ex( p_paragraph->p_types,
+    i_max = fribidi_get_par_embedding_levels_ex(
+                                      p_paragraph->p_types,
                                       p_paragraph->p_btypes,
                                       p_paragraph->i_size,
                                       &p_paragraph->paragraph_type,
                                       p_paragraph->p_levels );
 #else
-    fribidi_get_par_embedding_levels( p_paragraph->p_types,
+    i_max = fribidi_get_par_embedding_levels(
+                                      p_paragraph->p_types,
                                       p_paragraph->i_size,
                                       &p_paragraph->paragraph_type,
                                       p_paragraph->p_levels );
 #endif
+    if( i_max == 0 )
+        return VLC_EGENERIC;
 
 #ifdef HAVE_HARFBUZZ
     hb_unicode_funcs_t *p_funcs =



More information about the vlc-commits mailing list