diff options
| author | Philipp Stephani | 2016-11-09 23:13:52 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2016-11-18 18:02:57 +0100 |
| commit | 0d913da15c094bf596dd685acecf3438228c15cf (patch) | |
| tree | 342d5e0222a35dc93cca8858317e038a76e91c27 /lisp | |
| parent | 49ac78022802dfff08367477e8d09d17d3c73e68 (diff) | |
| download | emacs-0d913da15c094bf596dd685acecf3438228c15cf.tar.gz 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')
| -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." | |||
| 2672 | (when (cddr list) | 2672 | (when (cddr list) |
| 2673 | (error "Garbage following &rest VAR in lambda-list"))) | 2673 | (error "Garbage following &rest VAR in lambda-list"))) |
| 2674 | ((eq arg '&optional) | 2674 | ((eq arg '&optional) |
| 2675 | (unless (cdr list) | 2675 | (when (or (null (cdr list)) |
| 2676 | (error "Variable name missing after &optional"))) | 2676 | (memq (cadr list) '(&optional &rest))) |
| 2677 | (error "Variable name missing after &optional")) | ||
| 2678 | (when (memq '&optional (cddr list)) | ||
| 2679 | (error "Duplicate &optional"))) | ||
| 2677 | ((memq arg vars) | 2680 | ((memq arg vars) |
| 2678 | (byte-compile-warn "repeated variable %s in lambda-list" arg)) | 2681 | (byte-compile-warn "repeated variable %s in lambda-list" arg)) |
| 2679 | (t | 2682 | (t |