summaryrefslogtreecommitdiff
path: root/pango/pango-emoji.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-08-17 22:29:36 -0400
committerMatthias Clasen <mclasen@redhat.com>2018-08-17 22:33:41 -0400
commit71aaeaf020340412b8d012fe23a556c0420eda5f (patch)
treed82de9210d5bd020b8b28e12fbb29378e1a81134 /pango/pango-emoji.c
parentccfd3b466ca43b202681ce951600aac8f97d8dc4 (diff)
downloadpango-71aaeaf020340412b8d012fe23a556c0420eda5f.tar.gz
Prevent an assertion with invalid Unicode sequences
Invalid Unicode sequences, such as 0x2665 0xfe0e 0xfe0f, can trick the Emoji iter code into returning an empty segment, which then triggers an assertion in the itemizer. Prevent this by ensuring that we make progress. This issue was reported by Jeffrey M.
Diffstat (limited to 'pango/pango-emoji.c')
-rw-r--r--pango/pango-emoji.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pango/pango-emoji.c b/pango/pango-emoji.c
index 0e332dff..29472452 100644
--- a/pango/pango-emoji.c
+++ b/pango/pango-emoji.c
@@ -253,6 +253,12 @@ _pango_emoji_iter_next (PangoEmojiIter *iter)
if (iter->is_emoji == PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type))
{
iter->is_emoji = !PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type);
+
+ /* Make sure we make progress. Weird sequences, like a VC15 followed
+ * by VC16, can trick us into stalling otherwise. */
+ if (iter->start == iter->end)
+ iter->end = g_utf8_next_char (iter->end);
+
return TRUE;
}
}