Subject: bug#20128: 24.4; Bad regex in composition-function-table hangs Emacs

From: Richard Wordingham <[email-masked]>
Date: Tue, 17 Mar 2015 19:45:04 +0000

Loading an Emacs lisp file (e.g. by load-file in .emacs) containing the
commands:

(defvar tai-tham-composable-pattern
  (let ((table
	 '(
	   ("C" . "[\u1A20-\u1A54") ; Missing ']'!
	   ("M" . "[\u1A55-\u1A5E\u1A61-\u1A7C\u1A7F]"); Mark
	   ("H" . "\u1A60") ; sakot
	   ("N" . "\u1A58"))) ; mai kang lai
	(regexp "C\\(M|HC\\)*\\(NC\\(M|HC\\)*\\)*N?"))
    (let ((case-fold-search nil))
      (dolist (elt table)
	(setq regexp (replace-regexp-in-string (car elt) (cdr elt)
					       regexp t t))))
    regexp))

(let ((elt (list (vector tai-tham-composable-pattern 0
'font-shape-gstring)
                 (vector "." 0 'font-shape-gstring) )))
  (set-char-table-range composition-function-table '(#x1A20 . #x1AAD)
elt))

causes Emacs to hang when a character in the range U+1A20 to U+1AAD
needs to be rendered.  Now, the value of tai-tham-composable-pattern is
an unbalanced regex, so that may be the cause of the problem.

The problem also occurs in Emacs 23.3.