diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2019-02-07 19:05:06 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2019-06-23 20:31:48 +0200 |
commit | 2eafb4af55cc835694a0e747835b88145d20a94d (patch) | |
tree | a7a2d29ebfa40e84707847040defb0118c14cc33 /lisp/emacs-lisp | |
parent | 866f527ddf21050a827fa47e04cfe6163f1c7053 (diff) | |
download | emacs-2eafb4af55cc835694a0e747835b88145d20a94d.tar.gz emacs-2eafb4af55cc835694a0e747835b88145d20a94d.tar.bz2 emacs-2eafb4af55cc835694a0e747835b88145d20a94d.zip |
Check validity of rx submatch-n number
* lisp/emacs-lisp/rx.el (rx-submatch): Type and range check (Bug#34373).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/rx.el | 2 |
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...)'." (defun rx-submatch-n (form) "Parse and produce code from FORM, which is `(submatch-n N ...)'." (let ((n (nth 1 form))) + (unless (and (integerp n) (> n 0)) + (error "rx `submatch-n' argument must be positive")) (concat "\\(?" (number-to-string n) ":" (if (= 3 (length form)) ;; Only one sub-form. |