Blame SOURCES/pango-fixes-bidi-crash.patch

5e14b3
commit 490f8979a260c16b1df055eab386345da18a2d54
5e14b3
Author: Matthias Clasen <mclasen@redhat.com>
5e14b3
Date:   Wed Jul 10 20:26:23 2019 -0400
5e14b3
5e14b3
    bidi: Be safer against bad input
5e14b3
    
5e14b3
    Don't run off the end of an array that we
5e14b3
    allocated to certain length.
5e14b3
    
5e14b3
    Closes: https://gitlab.gnome.org/GNOME/pango/issues/342
5e14b3
5e14b3
diff --git a/pango/pango-bidi-type.c b/pango/pango-bidi-type.c
5e14b3
index 3e46b66c..5c02dbbb 100644
5e14b3
--- a/pango/pango-bidi-type.c
5e14b3
+++ b/pango/pango-bidi-type.c
5e14b3
@@ -181,8 +181,11 @@ pango_log2vis_get_embedding_levels (const gchar    *text,
5e14b3
   for (i = 0, p = text; p < text + length; p = g_utf8_next_char(p), i++)
5e14b3
     {
5e14b3
       gunichar ch = g_utf8_get_char (p);
5e14b3
-      FriBidiCharType char_type;
5e14b3
-      char_type = fribidi_get_bidi_type (ch);
5e14b3
+      FriBidiCharType char_type = fribidi_get_bidi_type (ch);
5e14b3
+
5e14b3
+      if (i == n_chars)
5e14b3
+        break;
5e14b3
+
5e14b3
       bidi_types[i] = char_type;
5e14b3
       ored_types |= char_type;
5e14b3
       if (FRIBIDI_IS_STRONG (char_type))