From 927856d3c6db92a0fff279a15eae303bdf4a7820 Mon Sep 17 00:00:00 2001 From: Alastair Bridgewater Date: Sat, 28 Nov 2009 22:53:45 +0000 Subject: [PATCH] 1.0.33.2: Fix bug 489698 (reading #p"\\\\" on windows). * Actual bug was a missed range check prior to calling POSITION in EXTRACT-DEVICE in src;code;win32-pathname. Fixed. * Added test case. --- NEWS | 2 ++ src/code/win32-pathname.lisp | 2 +- tests/pathnames.impure.lisp | 9 +++++++++ version.lisp-expr | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index f2b2950..488934f 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ changes relative to sbcl-1.0.33: * enhancement: SB-INTROSPECT:DEFTYPE-LAMBDA-LIST now also works on most builtin types. + * bug fix: #p"\\\\" can now be read without error on Win32 (reported by +Willem Broekema; launchpad bug #489698). changes in sbcl-1.0.33 relative to sbcl-1.0.32: * new port: support added for x86-64 NetBSD. (thanks to Aymeric Vincent) diff --git a/src/code/win32-pathname.lisp b/src/code/win32-pathname.lisp index 8edaeda..a982f68 100644 --- a/src/code/win32-pathname.lisp +++ b/src/code/win32-pathname.lisp @@ -20,7 +20,7 @@ (cond ((and (eql c1 #\:) (alpha-char-p c0)) ;; "X:" style, saved as X (values (string (char namestr start)) (+ start 2))) - ((and (member c0 '(#\/ #\\)) (eql c0 c1)) + ((and (member c0 '(#\/ #\\)) (eql c0 c1) (>= end (+ start 3))) ;; "//UNC" style, saved as UNC ;; FIXME: at unparsing time we tell these apart by length, ;; which seems a bit lossy -- presumably one-letter UNC diff --git a/tests/pathnames.impure.lisp b/tests/pathnames.impure.lisp index 5e9a8b8..7ed7250 100644 --- a/tests/pathnames.impure.lisp +++ b/tests/pathnames.impure.lisp @@ -477,4 +477,13 @@ (assert (eq :type-error-ok (handler-case (logical-pathname "SYS:%") (type-error () :type-error-ok))))) + +;;; Reported by Willem Broekema: Reading #p"\\\\" caused an error due +;;; to insufficient sanity in input testing in EXTRACT-DEVICE (in +;;; src;code;win32-pathname). +#+win32 +(with-test (:name :bug-489698) + (assert (equal (make-pathname :directory '(:absolute)) + (read-from-string "#p\"\\\\\\\\\"")))) + ;;;; success diff --git a/version.lisp-expr b/version.lisp-expr index 3fc8d74..6d6c89b 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.33.1" +"1.0.33.2" -- 1.7.10.4