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

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