diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-05-23 12:39:57 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-05-23 12:41:46 -0400 |
commit | 0e9dcc976b2a3f08f239d393f49ca2907cec099b (patch) | |
tree | 3e968cbfe442b7399e1bd9b1c81b5edcf50940d9 /pango | |
parent | 483b7cc92a4d81dbd395f0b9ddbab4678d33884e (diff) | |
download | pango-0e9dcc976b2a3f08f239d393f49ca2907cec099b.tar.gz |
Avoid unsigned int pitfalls
When we tried to catch attr list overflow in
895759096309e7c, we overlooked that add - remove
can be negative, leading to unexpected results.
Avoid this case.
Fixes: #561
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pango-attributes.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index 63c031f9..f97892a6 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -1777,7 +1777,8 @@ pango_attr_list_update (PangoAttrList *list, } else if (attr->end_index >= pos + remove) { - if (G_MAXUINT - attr->end_index < add - remove) + if (add > remove && + G_MAXUINT - attr->end_index < add - remove) attr->end_index = G_MAXUINT; else attr->end_index += add - remove; |