Skip to content

Commit 71aaeaf

Browse files
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.
1 parent ccfd3b4 commit 71aaeaf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: pango/pango-emoji.c

+6
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ _pango_emoji_iter_next (PangoEmojiIter *iter)
253253
if (iter->is_emoji == PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type))
254254
{
255255
iter->is_emoji = !PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type);
256+
257+
/* Make sure we make progress. Weird sequences, like a VC15 followed
258+
* by VC16, can trick us into stalling otherwise. */
259+
if (iter->start == iter->end)
260+
iter->end = g_utf8_next_char (iter->end);
261+
256262
return TRUE;
257263
}
258264
}

0 commit comments

Comments
 (0)