[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 fe27e03: Fix rx matcher overflow without limiting
From: |
Tassilo Horn |
Subject: |
[Emacs-diffs] emacs-25 fe27e03: Fix rx matcher overflow without limiting |
Date: |
Mon, 14 Dec 2015 17:25:13 +0000 |
branch: emacs-25
commit fe27e037663d36be3e5741c2ce86ab4ee8017db1
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>
Fix rx matcher overflow without limiting
* lisp/textmodes/reftex-vars.el (reftex-label-regexps): Improve last
change to the regexp without imposing a limit on the length of the
options.
---
lisp/textmodes/reftex-vars.el | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index fcab136..9bc1d2d 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -877,7 +877,17 @@ DOWNCASE t: Downcase words before using them."
"\\\\label{\\(?1:[^}]*\\)}"
;; keyvals [..., label = {foo}, ...] forms used by ctable,
;; listings, minted, ...
-
"\\[[^][]\\{0,2000\\}\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?")
+ ;;
+ ;; If you think the first shy group is a bit strange, it is like
+ ;; that in order not to overflow the regexp matcher stack in the
+ ;; presence of unbalanced brackets, i.e., a [ and then no
+ ;; closing bracket anymore. In "[^[],]*,", the "*" repetition
+ ;; will be done without any need to record state for eventual
+ ;; backtracking because the "," is mutually exclusive with the
+ ;; "[^][,]", and the regexp matcher includes a special
+ ;; optimization for that case since it's common and very
+ ;; useful). (Hint by Stefan Monnier)
+ "\\[\\(?:[^][,]*,\\)*[
\t]*\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?")
"List of regexps matching \\label definitions.
The default value matches usual \\label{...} definitions and
keyval style [..., label = {...}, ...] label definitions. It is
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-25 fe27e03: Fix rx matcher overflow without limiting,
Tassilo Horn <=