1.0.35.20: More robust checking for DEFMETHOD argument specializers
authorNathan Froyd <froydnj@cs.rice.edu>
Sat, 27 Feb 2010 16:22:56 +0000 (16:22 +0000)
committerNathan Froyd <froydnj@cs.rice.edu>
Sat, 27 Feb 2010 16:22:56 +0000 (16:22 +0000)
Fixes lp#525916, reported by Reinout Stevens.

NEWS
src/pcl/boot.lisp
tests/clos.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index c58fb1f..19a996e 100644 (file)
--- 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
index e9eb7a6..7022936 100644 (file)
@@ -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)
index 46a36a8..7a313b9 100644 (file)
 (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
index bca08cd..fcc7a2e 100644 (file)
@@ -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"