diff lisp/font-lock.el @ 64265:dde987aec664

(font-lock-fontify-keywords-region): Avoid inf-loops when the matched text is empty.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 13 Jul 2005 04:39:14 +0000
parents 6fb026ad601f
children 44d210b5de14 fbb2bea03df9
line wrap: on
line diff
--- a/lisp/font-lock.el	Tue Jul 12 23:29:29 2005 +0000
+++ b/lisp/font-lock.el	Wed Jul 13 04:39:14 2005 +0000
@@ -1473,7 +1473,11 @@
       (while (and (< (point) end)
 		  (if (stringp matcher)
 		      (re-search-forward matcher end t)
-		    (funcall matcher end)))
+		    (funcall matcher end))
+                  ;; Beware empty string matches since they will
+                  ;; loop indefinitely.
+                  (or (> (point) (match-beginning 0))
+                      (progn (forward-char 1) t)))
 	(when (and font-lock-multiline
 		   (>= (point)
 		       (save-excursion (goto-char (match-beginning 0))