aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTassilo Horn2015-12-14 18:23:31 +0100
committerTassilo Horn2015-12-14 18:23:31 +0100
commitfe27e037663d36be3e5741c2ce86ab4ee8017db1 (patch)
treec202fa2be8a67fb3e987c7b8dc26e86568688c4d
parentea98cc9f49489d29f0cee08ebc3dc0f9f4abe1fd (diff)
downloademacs-fe27e037663d36be3e5741c2ce86ab4ee8017db1.tar.gz
emacs-fe27e037663d36be3e5741c2ce86ab4ee8017db1.zip
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.
-rw-r--r--lisp/textmodes/reftex-vars.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index fcab1367f7d..9bc1d2d3af8 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -877,7 +877,17 @@ DOWNCASE t: Downcase words before using them."
877 "\\\\label{\\(?1:[^}]*\\)}" 877 "\\\\label{\\(?1:[^}]*\\)}"
878 ;; keyvals [..., label = {foo}, ...] forms used by ctable, 878 ;; keyvals [..., label = {foo}, ...] forms used by ctable,
879 ;; listings, minted, ... 879 ;; listings, minted, ...
880 "\\[[^][]\\{0,2000\\}\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?") 880 ;;
881 ;; If you think the first shy group is a bit strange, it is like
882 ;; that in order not to overflow the regexp matcher stack in the
883 ;; presence of unbalanced brackets, i.e., a [ and then no
884 ;; closing bracket anymore. In "[^[],]*,", the "*" repetition
885 ;; will be done without any need to record state for eventual
886 ;; backtracking because the "," is mutually exclusive with the
887 ;; "[^][,]", and the regexp matcher includes a special
888 ;; optimization for that case since it's common and very
889 ;; useful). (Hint by Stefan Monnier)
890 "\\[\\(?:[^][,]*,\\)*[ \t]*\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?")
881 "List of regexps matching \\label definitions. 891 "List of regexps matching \\label definitions.
882The default value matches usual \\label{...} definitions and 892The default value matches usual \\label{...} definitions and
883keyval style [..., label = {...}, ...] label definitions. It is 893keyval style [..., label = {...}, ...] label definitions. It is