]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix string-glyph-split infloop
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 24 Nov 2021 07:27:22 +0000 (08:27 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 24 Nov 2021 07:27:22 +0000 (08:27 +0100)
* lisp/emacs-lisp/subr-x.el (string-glyph-split): Fix infloop when
applied to (string-glyph-split "✈️🌍") (bug#52067).

lisp/emacs-lisp/subr-x.el

index b2dae564c2ba588b57c522a1f7c56eea7158e6ff..95254b946e5379c79683706045ef49eae0ee4aa6 100644 (file)
@@ -456,7 +456,12 @@ This takes into account combining characters and grapheme clusters."
         (start 0)
         comp)
     (while (< start (length string))
-      (if (setq comp (find-composition-internal start nil string nil))
+      (if (setq comp (find-composition-internal
+                      start
+                      ;; Don't search backward in the string for the
+                      ;; start of the composition.
+                      (min (length string) (1+ start))
+                      string nil))
           (progn
             (push (substring string (car comp) (cadr comp)) result)
             (setq start (cadr comp)))