From: Nathan Froyd Date: Sat, 27 Feb 2010 16:22:56 +0000 (+0000) Subject: 1.0.35.20: More robust checking for DEFMETHOD argument specializers X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=18721282cf227183dd37a273f094535535f91a1d;p=sbcl.git 1.0.35.20: More robust checking for DEFMETHOD argument specializers Fixes lp#525916, reported by Reinout Stevens. --- diff --git a/NEWS b/NEWS index c58fb1f..19a996e 100644 --- a/NEWS +++ b/NEWS @@ -37,6 +37,8 @@ changes relative to sbcl-1.0.35: real power. (launchpad bug lp#525949) * bug fix: Fix SB-EXT:GENERATION-* accessors for generations > 0 on GENCGC platforms. (launchpad bug lp#529014) + * bug fix: More robust checks for invalid DEFMETHOD argument specializers. + (launchpad bug lp#525916) changes in sbcl-1.0.35 relative to sbcl-1.0.34: * optimization: ROUND with a single single-float or double-float argument diff --git a/src/pcl/boot.lisp b/src/pcl/boot.lisp index e9eb7a6..7022936 100644 --- a/src/pcl/boot.lisp +++ b/src/pcl/boot.lisp @@ -2711,6 +2711,14 @@ bootstrapping. (t (multiple-value-bind (parameters lambda-list specializers required) (parse-specialized-lambda-list (cdr arglist)) + ;; Check for valid arguments. + (unless (or (and (symbolp arg) (not (null arg))) + (and (consp arg) + (consp (cdr arg)) + (null (cddr arg)))) + (error 'specialized-lambda-list-error + :format-control "arg is not a non-NIL symbol or a list of two elements: ~A" + :format-arguments (list arg))) (values (cons (if (listp arg) (car arg) arg) parameters) (cons (if (listp arg) (car arg) arg) lambda-list) (cons (if (listp arg) (cadr arg) t) specializers) diff --git a/tests/clos.impure.lisp b/tests/clos.impure.lisp index 46a36a8..7a313b9 100644 --- a/tests/clos.impure.lisp +++ b/tests/clos.impure.lisp @@ -71,6 +71,15 @@ (assert (expect-error (defgeneric foo5 (x &rest)))) (assert (expect-error (defmethod foo6 (x &rest)))) +;;; legal method specializers +(defclass bug-525916-1 () ()) +(defclass bug-525916-2 () ()) +(with-test (:name :bug-525916) +(assert (expect-error (defmethod invalid ((arg)) arg))) +(assert (expect-error (defmethod invalid (nil) 1))) +(assert (expect-error (defmethod invalid ((arg . bug-525916-1)) arg))) +(assert (expect-error (defmethod invalid ((arg bug-525916-1 bug-525916-2)) arg)))) + ;;; more lambda-list checking ;;; ;;; DEFGENERIC lambda lists are subject to various limitations, as per diff --git a/version.lisp-expr b/version.lisp-expr index bca08cd..fcc7a2e 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.35.19" +"1.0.35.20"