[pango] Avoid a critical from markup parsing



commit 2df0c204d31f1f734491302b5640735030f325e5
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 5 18:22:32 2019 -0400

    Avoid a critical from markup parsing
    
    gravity='auto' is not a valid value here.
    
    Closes: https://gitlab.gnome.org/GNOME/pango/issues/203

 pango/pango-markup.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/pango/pango-markup.c b/pango/pango-markup.c
index 22bf4fef..7420fa85 100644
--- a/pango/pango-markup.c
+++ b/pango/pango-markup.c
@@ -1455,6 +1455,19 @@ span_parse_func     (MarkupData            *md G_GNUC_UNUSED,
       if (!span_parse_enum ("gravity", gravity, PANGO_TYPE_GRAVITY, (int*)(void*)&gr, line_number, error))
        goto error;
 
+      if (gr == PANGO_GRAVITY_AUTO)
+        {
+         g_set_error (error,
+                      G_MARKUP_ERROR,
+                      G_MARKUP_ERROR_INVALID_CONTENT,
+                      _("'%s' is not a valid value for the 'stretch' "
+                        "attribute on <span> tag, line %d; valid "
+                        "values are for example 'south', 'east', "
+                        "'north', 'west'"),
+                      gravity, line_number);
+         goto error;
+        }
+
       add_attribute (tag, pango_attr_gravity_new (gr));
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]