From cc71ce51d3e54515dcdc7d7758a85d3de69327e7 Mon Sep 17 00:00:00 2001
From: rtoy <rtoy>
Date: Wed, 18 Aug 2010 16:42:06 +0000
Subject: [PATCH] Oops.  The upper limit for the octet-count array is one less
 than the string-buffer-len because the string buffer has an extra element at
 the beginning (for unread-char).

---
 code/fd-stream.lisp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/code/fd-stream.lisp b/code/fd-stream.lisp
index 62e48d76b..23a6dd164 100644
--- a/code/fd-stream.lisp
+++ b/code/fd-stream.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.117 2010/08/15 13:03:43 rtoy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.118 2010/08/18 16:42:06 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -1716,9 +1716,10 @@
 			 ;; Note: string-index starts at 1 (because
 			 ;; index 0 is for the unread-char), but
 			 ;; octet-count doesn't use that.  Hence,
-			 ;; subtract one from string-index.
+			 ;; subtract one from string-index and
+			 ;; string-buffer-len.
 			 (loop for k of-type fixnum from (1- (fd-stream-string-index stream))
-			    below (fd-stream-string-buffer-len stream)
+			    below (1- (fd-stream-string-buffer-len stream))
 			    do (decf posn (aref ocount k)))))
 		     (decf posn (- (fd-stream-ibuf-tail stream)
 				   (fd-stream-ibuf-head stream))))
-- 
GitLab