emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2eafb4a: Check validity of rx submatch-n number


From: Mattias Engdegård
Subject: [Emacs-diffs] master 2eafb4a: Check validity of rx submatch-n number
Date: Sun, 23 Jun 2019 14:33:01 -0400 (EDT)

branch: master
commit 2eafb4af55cc835694a0e747835b88145d20a94d
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    Check validity of rx submatch-n number
    
    * lisp/emacs-lisp/rx.el (rx-submatch): Type and range check (Bug#34373).
---
 lisp/emacs-lisp/rx.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 8ef78fd..2130e3e 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]