0002-Prevent-an-assertion-with-invalid-Unicode-sequences.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 71aaeaf020340412b8d012fe23a556c0420eda5f Mon Sep 17 00:00:00 2001
  2. From: Matthias Clasen <mclasen@redhat.com>
  3. Date: Fri, 17 Aug 2018 22:29:36 -0400
  4. Subject: [PATCH] Prevent an assertion with invalid Unicode sequences
  5. Invalid Unicode sequences, such as 0x2665 0xfe0e 0xfe0f,
  6. can trick the Emoji iter code into returning an empty
  7. segment, which then triggers an assertion in the itemizer.
  8. Prevent this by ensuring that we make progress.
  9. This issue was reported by Jeffrey M.
  10. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  11. ---
  12. pango/pango-emoji.c | 6 ++++++
  13. 1 file changed, 6 insertions(+)
  14. diff --git a/pango/pango-emoji.c b/pango/pango-emoji.c
  15. index 0e332dff..29472452 100644
  16. --- a/pango/pango-emoji.c
  17. +++ b/pango/pango-emoji.c
  18. @@ -253,6 +253,12 @@ _pango_emoji_iter_next (PangoEmojiIter *iter)
  19. if (iter->is_emoji == PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type))
  20. {
  21. iter->is_emoji = !PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type);
  22. +
  23. + /* Make sure we make progress. Weird sequences, like a VC15 followed
  24. + * by VC16, can trick us into stalling otherwise. */
  25. + if (iter->start == iter->end)
  26. + iter->end = g_utf8_next_char (iter->end);
  27. +
  28. return TRUE;
  29. }
  30. }
  31. --
  32. 2.11.0