summaryrefslogtreecommitdiff
path: root/docutils/tools
diff options
context:
space:
mode:
authorsmerten <smerten@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2010-08-07 14:43:19 +0000
committersmerten <smerten@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2010-08-07 14:43:19 +0000
commite0e71bacc99f67b84839bd544747acb660fce4ce (patch)
tree3f09fe5a2c315a49cc9d915a1dcdb1eddda0788f /docutils/tools
parent896a1b33f87b8f37e527d79aa8763b6c434d7ea7 (diff)
downloaddocutils-e0e71bacc99f67b84839bd544747acb660fce4ce.tar.gz
Inline markup is constrained to a length of 1000 characters to pacify
regular expression matcher. Fixes "Stack overflow in regexp matcher" occuring occasionally in complicated documents. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@6383 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/tools')
-rw-r--r--docutils/tools/editors/emacs/rst.el17
1 files changed, 12 insertions, 5 deletions
diff --git a/docutils/tools/editors/emacs/rst.el b/docutils/tools/editors/emacs/rst.el
index 40213d64a..cfb005284 100644
--- a/docutils/tools/editors/emacs/rst.el
+++ b/docutils/tools/editors/emacs/rst.el
@@ -2754,6 +2754,10 @@ details check the Rst Faces Defaults group."
(string-match "[[:alpha:]]" "b")
"Non-nil if we can use the character classes in our regexps.")
+(defconst rst-max-inline-length
+ 1000
+ "Maximum length of inline markup to recognize.")
+
(defvar rst-font-lock-keywords
;; The reST-links in the comments below all relate to sections in
;; http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html
@@ -2788,18 +2792,21 @@ details check the Rst Faces Defaults group."
;; There seems to be a bug leading to error "Stack overflow in regexp
;; matcher" when "|" or "\\*" are the characters searched for
- (re-imendbeg
+ (re-imendbegbeg
(if (< emacs-major-version 21)
"]"
"\\]\\|\\\\."))
;; inline markup content end
- (re-imend (concat re-imendbeg "\\)*[^\t \\\\]\\)"))
+ (re-imendbeg (concat re-imendbegbeg "\\)\\{0,"
+ (format "%d" rst-max-inline-length)
+ "\\}[^\t "))
+ (re-imendend "\\\\]\\)")
;; inline markup content without asterisk
- (re-ima2 (concat re-imbeg2 "*" re-imend))
+ (re-ima2 (concat re-imbeg2 "*" re-imendbeg "*" re-imendend))
;; inline markup content without backquote
- (re-imb2 (concat re-imbeg2 "`" re-imend))
+ (re-imb2 (concat re-imbeg2 "`" re-imendbeg "`" re-imendend))
;; inline markup content without vertical bar
- (re-imv2 (concat re-imbeg2 "|" re-imend))
+ (re-imv2 (concat re-imbeg2 "|" re-imendbeg "|" re-imendend))
;; Supported URI schemes
(re-uris1 "\\(acap\\|cid\\|data\\|dav\\|fax\\|file\\|ftp\\|gopher\\|http\\|https\\|imap\\|ldap\\|mailto\\|mid\\|modem\\|news\\|nfs\\|nntp\\|pop\\|prospero\\|rtsp\\|service\\|sip\\|tel\\|telnet\\|tip\\|urn\\|vemmi\\|wais\\)")
;; Line starting with adornment and optional whitespace; complete