summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2018-02-15 09:35:24 +0100
committerCarlos Garnacho <carlosg@gnome.org>2018-02-15 10:06:26 +0100
commit34a2b58573a4879fd3e07d1fd946b57e46234723 (patch)
treeebcfd7cc7505272835cbafc14af17106ba3b7639
parent3fffbb8c4001c8f6d8409630ec8ab740fdb7e002 (diff)
downloadvte-34a2b58573a4879fd3e07d1fd946b57e46234723.tar.gz
widget: Protect fudge_pango_colors() against all-inclusive PangoAttributes
PangoAttribute documentation says "By default an attribute will have an all-inclusive range of [0,G_MAXUINT]". It seems legal to get that from IMs (referring to the pre-edit string), however the only caller of this function just relies on the attribute being within the VteCells range, leading to crashes. https://bugzilla.gnome.org/show_bug.cgi?id=793480
-rw-r--r--src/vte.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vte.cc b/src/vte.cc
index cef4c248..30a4178b 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -9360,7 +9360,7 @@ VteTerminalPrivate::translate_pango_cells(PangoAttrList *attrs,
list,
cells +
attr->start_index,
- attr->end_index -
+ MIN(n_cells, attr->end_index) -
attr->start_index);
g_slist_foreach(list,
(GFunc)pango_attribute_destroy,