diff options
author | Philipp Stephani <phst@google.com> | 2016-11-09 23:13:52 +0100 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2016-11-18 18:02:57 +0100 |
commit | 0d913da15c094bf596dd685acecf3438228c15cf (patch) | |
tree | 342d5e0222a35dc93cca8858317e038a76e91c27 /lisp/emacs-lisp/bytecomp.el | |
parent | 49ac78022802dfff08367477e8d09d17d3c73e68 (diff) | |
download | emacs-0d913da15c094bf596dd685acecf3438228c15cf.tar.gz emacs-0d913da15c094bf596dd685acecf3438228c15cf.tar.bz2 emacs-0d913da15c094bf596dd685acecf3438228c15cf.zip |
Prevent dubious argument lists
See Bug#24912 and Bug#24913.
* src/eval.c (funcall_lambda): Detect more dubious argument lists.
* lisp/emacs-lisp/bytecomp.el (byte-compile-check-lambda-list): Detect
more dubious argument lists.
* test/src/eval-tests.el (eval-tests--bugs-24912-and-24913): Add unit
test.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 428e21c7a39..85daa43eaed 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2672,8 +2672,11 @@ If FORM is a lambda or a macro, byte-compile it as a function." (when (cddr list) (error "Garbage following &rest VAR in lambda-list"))) ((eq arg '&optional) - (unless (cdr list) - (error "Variable name missing after &optional"))) + (when (or (null (cdr list)) + (memq (cadr list) '(&optional &rest))) + (error "Variable name missing after &optional")) + (when (memq '&optional (cddr list)) + (error "Duplicate &optional"))) ((memq arg vars) (byte-compile-warn "repeated variable %s in lambda-list" arg)) (t |