diff options
author | Philipp Stephani <phst@google.com> | 2017-03-26 20:53:43 +0200 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2017-04-08 17:15:31 +0200 |
commit | 98bfac68b98e051425c41873edc48f9af5c92361 (patch) | |
tree | 344d18686c78659e7cbe843080658d08cab0c4af /lisp/subr.el | |
parent | 5ea696fd24c2bd8006050866fba0ccab1c0ff931 (diff) | |
download | emacs-98bfac68b98e051425c41873edc48f9af5c92361.tar.gz |
Validate SPEC of `dolist', cf. Bug#25477.
* lisp/subr.el (dolist): Test type and length of SPEC.
* test/lisp/subr-tests.el (subr-tests--dolist--wrong-number-of-args):
Add unit test.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 13567d8753e..1dd5d2ffef9 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -190,6 +190,10 @@ Then evaluate RESULT to get return value, default nil. \(fn (VAR LIST [RESULT]) BODY...)" (declare (indent 1) (debug ((symbolp form &optional form) body))) + (unless (consp spec) + (signal 'wrong-type-argument (list 'consp spec))) + (unless (<= 2 (length spec) 3) + (signal 'wrong-number-of-arguments (list '(2 . 3) (length spec)))) ;; It would be cleaner to create an uninterned symbol, ;; but that uses a lot more space when many functions in many files ;; use dolist. |