]> git.eshelyaron.com Git - emacs.git/commitdiff
(font-lock-fontify-keywords-region): Avoid inf-loops
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 13 Jul 2005 04:39:14 +0000 (04:39 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 13 Jul 2005 04:39:14 +0000 (04:39 +0000)
when the matched text is empty.

lisp/font-lock.el

index a1b30292e6131ef859d3060cc3b864392b4066cb..0a97be141df554474c133cfd5e9d3e3a3b1627bf 100644 (file)
@@ -1473,7 +1473,11 @@ LOUDLY, if non-nil, allows progress-meter bar."
       (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))