Skip to content

Commit

Permalink
Prevent an assertion with invalid Unicode sequences
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Matthias Clasen committed Aug 18, 2018
1 parent ccfd3b4 commit 71aaeaf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pango/pango-emoji.c
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 71aaeaf

Please sign in to comment.