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 /test | |
| 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 'test')
| -rw-r--r-- | test/src/eval-tests.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el index 75999e1a25a..fe08506ed25 100644 --- a/test/src/eval-tests.el +++ b/test/src/eval-tests.el | |||
| @@ -32,4 +32,19 @@ | |||
| 32 | ;; This should not crash. | 32 | ;; This should not crash. |
| 33 | (should-error (funcall '(closure)) :type 'invalid-function)) | 33 | (should-error (funcall '(closure)) :type 'invalid-function)) |
| 34 | 34 | ||
| 35 | (ert-deftest eval-tests--bugs-24912-and-24913 () | ||
| 36 | "Checks that Emacs doesn’t accept weird argument lists. | ||
| 37 | Bug#24912 and Bug#24913." | ||
| 38 | (dolist (args '((&optional) (&rest) (&optional &rest) (&rest &optional) | ||
| 39 | (&optional &rest a) (&optional a &rest) | ||
| 40 | (&rest a &optional) (&rest &optional a) | ||
| 41 | (&optional &optional) (&optional &optional a) | ||
| 42 | (&optional a &optional b) | ||
| 43 | (&rest &rest) (&rest &rest a) | ||
| 44 | (&rest a &rest b))) | ||
| 45 | (should-error (eval `(funcall (lambda ,args)) t) :type 'invalid-function) | ||
| 46 | (should-error (byte-compile-check-lambda-list args)) | ||
| 47 | (let ((byte-compile-debug t)) | ||
| 48 | (should-error (eval `(byte-compile (lambda ,args)) t))))) | ||
| 49 | |||
| 35 | ;;; eval-tests.el ends here | 50 | ;;; eval-tests.el ends here |