diff options
-rw-r--r-- | pango/pango-attributes.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index 4f96135b..3ef76a70 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -1697,6 +1697,10 @@ pango_attr_list_update (PangoAttrList *list, { guint i, p; + g_return_if_fail (pos >= 0); + g_return_if_fail (remove >= 0); + g_return_if_fail (add >= 0); + if (list->attributes) for (i = 0, p = list->attributes->len; i < p; i++) { @@ -1729,7 +1733,10 @@ pango_attr_list_update (PangoAttrList *list, } else if (attr->end_index >= pos + remove) { - attr->end_index += add - remove; + if (G_MAXUINT - attr->end_index < add - remove) + attr->end_index = G_MAXUINT; + else + attr->end_index += add - remove; } } } |