Update of /cvsroot/sbcl/sbcl/src/code
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv4601/src/code
Modified Files:
backq.lisp sharpm.lisp
Log Message:
1.0.36.21: stricter handling of invalid backquote expressions
Based on patch by: Stas Boukarev <stassats@...>
Fixed launchpad bug #309093.
Index: backq.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/backq.lisp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- backq.lisp 24 Apr 2009 10:44:09 -0000 1.16
+++ backq.lisp 12 Mar 2010 09:38:25 -0000 1.17
@@ -46,6 +46,7 @@
(defvar *bq-at-flag* '(|,@|))
(defvar *bq-dot-flag* '(|,.|))
(defvar *bq-vector-flag* '(|bqv|))
+(defvar *bq-error* "Comma not inside a backquote.")
(/show0 "backq.lisp 50")
@@ -68,7 +69,7 @@
(unless (> *backquote-count* 0)
(when *read-suppress*
(return-from comma-macro nil))
- (simple-reader-error stream "comma not inside a backquote"))
+ (simple-reader-error stream *bq-error*))
(let ((c (read-char stream))
(*backquote-count* (1- *backquote-count*)))
(cond ((char= c #\@)
Index: sharpm.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/sharpm.lisp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- sharpm.lisp 5 Oct 2008 09:53:31 -0000 1.23
+++ sharpm.lisp 12 Mar 2010 09:38:25 -0000 1.24
@@ -93,10 +93,15 @@
(when *read-suppress*
(read stream t nil t)
(return-from sharp-A nil))
- (unless dimensions (simple-reader-error stream
- "no dimensions argument to #A"))
+ (unless dimensions
+ (simple-reader-error stream "No dimensions argument to #A."))
(collect ((dims))
- (let* ((contents (read stream t nil t))
+ (let* ((*bq-error*
+ (if (zerop *backquote-count*)
+ *bq-error*
+ "Comma inside a backquoted array (not a list or general vector.)"))
+ (*backquote-count* 0)
+ (contents (read stream t nil t))
(seq contents))
(dotimes (axis dimensions
(make-array (dims) :initial-contents contents))
@@ -122,8 +127,14 @@
(when *read-suppress*
(read stream t nil t)
(return-from sharp-S nil))
- (let ((body (if (char= (read-char stream t) #\( )
- (read-list stream nil)
+ (let* ((*bq-error*
+ (if (zerop *backquote-count*)
+ *bq-error*
+ "Comma inside backquoted structure (not a list or general vector.)"))
+ (*backquote-count* 0)
+ (body (if (char= (read-char stream t) #\( )
+ (let ((*backquote-count* -1))
+ (read-list stream nil))
(simple-reader-error stream "non-list following #S"))))
(unless (listp body)
(simple-reader-error stream "non-list following #S: ~S" body))
|