[pango/attr-list-overflow: 1/2] Add some preconditions




commit b5031e6e57c9462097db5c58f3a2f6293e9625ff
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 23 19:48:52 2021 -0500

    Add some preconditions
    
    The arguments to pango_attr_list_update are ints,
    but negative numbers don't make sense here.

 pango/pango-attributes.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 4f96135b..38a41517 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++)
       {


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