diff --git a/racket/src/native-libs/build.rkt b/racket/src/native-libs/build.rkt index 1a79400920..082437c984 100644 --- a/racket/src/native-libs/build.rkt +++ b/racket/src/native-libs/build.rkt @@ -138,6 +138,9 @@ ;; (i.e., auto-find a suitable font) as implemented by `racket/draw` (define-runtime-path pango-emoji-patch "patches/pango-emoji.patch") +;; Merge a Pango patch that fixes a decoding problem +(define-runtime-path pango-emojiiter-patch "patches/pango-emojiiter.patch") + ;; Needed when building with old GCC, such as 4.0: (define-runtime-path gmp-weak-patch "patches/gmp-weak.patch") @@ -529,7 +532,8 @@ (list coretext-patch coretext-fontreg-patch coretext-nullarray - win32text-patch) + win32text-patch + pango-emojiiter-patch) (if (and mac? m32?) (list pango-surrogate-patch) null) diff --git a/racket/src/native-libs/patches/pango-emojiiter.patch b/racket/src/native-libs/patches/pango-emojiiter.patch new file mode 100644 index 0000000000..8c920676e8 --- /dev/null +++ b/racket/src/native-libs/patches/pango-emojiiter.patch @@ -0,0 +1,31 @@ +commit 71aaeaf020340412b8d012fe23a556c0420eda5f +Author: Matthias Clasen +Date: Fri Aug 17 22:29:36 2018 -0400 + + 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. + +diff --git a/pango/pango-emoji.c b/pango/pango-emoji.c +index 0e332dff..29472452 100644 +--- old/a/pango/pango-emoji.c ++++ new/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; + } + }