Subject: bug#11109: 24.0.94; vc-git-state: Stack overflow in regexp matcher

From: Andreas Schwab <[email-masked]>
Date: Wed, 28 Mar 2012 10:36:08 +0200

Sven Joachim <[email-masked]> writes:

> I'm getting frequent "Stack overflow in regexp matcher" errors when
> visiting files under git version control with uncommitted changes.  This
> started to happen rather recently.

Does that help?

Andreas.

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index bf7b7fb..b71dc95 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -220,11 +220,10 @@ matching the resulting Git log output, and KEYWORDS is a list of
     (let ((diff (vc-git--run-command-string
                  file "diff-index" "-p" "--raw" "-z" "HEAD" "--")))
       (if (and diff
-	       (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0\\(\\(?:.\\|\n\\)*\\)\\'"
+	       (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0\\(.\\)?"
 			     diff))
-          (let ((diff-letter (match-string 1 diff))
-                (diff-contents (match-string 2 diff)))
-            (if (not (string-match "\n." diff-contents))
+          (let ((diff-letter (match-string 1 diff)))
+            (if (not (match-beginning 2))
                 ;; Empty diff: file contents is the same as the HEAD
                 ;; revision, but timestamps are different (eg, file
                 ;; was "touch"ed).  Update timestamp in index:

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."