summaryrefslogtreecommitdiff
path: root/lisp/font-lock.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2005-07-13 04:39:14 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2005-07-13 04:39:14 +0000
commit8a08764f7a72eb062a85733b045fb50291d6aee9 (patch)
tree3ce0ef9837855ef7182afad6d403ca650ecacc4f /lisp/font-lock.el
parentf3eb269f58126b3ea58fc2a64030b53a48220e6c (diff)
downloademacs-8a08764f7a72eb062a85733b045fb50291d6aee9.tar.gz
(font-lock-fontify-keywords-region): Avoid inf-loops
when the matched text is empty.
Diffstat (limited to 'lisp/font-lock.el')
-rw-r--r--lisp/font-lock.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index a1b30292e61..0a97be141df 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -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))