aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2019-02-07 19:05:06 +0100
committerMattias EngdegÄrd2019-06-23 20:31:48 +0200
commit2eafb4af55cc835694a0e747835b88145d20a94d (patch)
treea7a2d29ebfa40e84707847040defb0118c14cc33
parent866f527ddf21050a827fa47e04cfe6163f1c7053 (diff)
downloademacs-2eafb4af55cc835694a0e747835b88145d20a94d.tar.gz
emacs-2eafb4af55cc835694a0e747835b88145d20a94d.zip
Check validity of rx submatch-n number
* lisp/emacs-lisp/rx.el (rx-submatch): Type and range check (Bug#34373).
-rw-r--r--lisp/emacs-lisp/rx.el2
1 files changed, 2 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 8ef78fd69e6..2130e3e1aea 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -725,6 +725,8 @@ FORM is either `(repeat N FORM1)' or `(repeat N M FORMS...)'."
725(defun rx-submatch-n (form) 725(defun rx-submatch-n (form)
726 "Parse and produce code from FORM, which is `(submatch-n N ...)'." 726 "Parse and produce code from FORM, which is `(submatch-n N ...)'."
727 (let ((n (nth 1 form))) 727 (let ((n (nth 1 form)))
728 (unless (and (integerp n) (> n 0))
729 (error "rx `submatch-n' argument must be positive"))
728 (concat "\\(?" (number-to-string n) ":" 730 (concat "\\(?" (number-to-string n) ":"
729 (if (= 3 (length form)) 731 (if (= 3 (length form))
730 ;; Only one sub-form. 732 ;; Only one sub-form.