[elephant-devel] Suspected bug in sleepycat.lisp file

Ben Lee midfield at gmail.com
Wed Sep 21 04:41:00 UTC 2005


it looks like you're right.  but instead of sending me a patch...

who wants the keys to the car?  (actually i'm not exactly sure how to 
hand them over.)

B

Robert L. Read wrote:
> While working on implementing Elephant on top of CL-SQL, which 
> led me to do base64 encoding of the serialized lisp objects, I discovered
> what I suspect to be a (normally) unexercised bug in buffer-read-byte,
> namely that it currently uses ":char" instead of :unsigned-byte.
> 
> This bug goes unnoticed because the serializer only puts values less than 
> 128 into the position that it reads with this routine.  I discovered it
> because I am using this routine to read out the whole buffer-stream into
> a byte-vector for the purpose of base64 encoding so that I can put it into
> a text field in PostGres safely.
> 
> If you make this change, all of the tests still run exactly as they did.
> 
> 
> 
> 
> (defun buffer-read-byte (bs)
>   "Read a byte."
>   (declare (optimize (speed 3) (safety 0))
> 	   (type buffer-stream bs))
>   (let ((position (buffer-stream-position bs)))
>     (incf (buffer-stream-position bs))
>    (deref-array (buffer-stream-buffer bs) '(:array _*:unsigned-byte*_) position)))
> 
> @@ -733,7 +736,33 @@
>            (type buffer-stream bs))
>    (let ((position (buffer-stream-position bs)))
>      (incf (buffer-stream-position bs))
> -    (deref-array (buffer-stream-buffer bs) '(:array :char) position)))
> +   (deref-array (buffer-stream-buffer bs) '(:array :unsigned-byte) position)))
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel



More information about the elephant-devel mailing list