Incorporate fix for partial updates ending on rest boundaries from sbcl.

In all previous versions, if an update-md5-state call received a
sequence which exactly filled a partially filled buffer, then that
buffer block was ignored and the agregate data not updated.
This commit is contained in:
2012-10-15 01:46:12 +02:00
parent 2b771017bb
commit 3dfb0b9be4

View File

@ -404,11 +404,15 @@ bounded by start and end, which must be numeric bounding-indices."
(declare (type (integer 0 63) amount))
(copy-to-buffer sequence start amount buffer buffer-index)
(setq start (the fixnum (+ start amount)))
(when (>= start end)
(setf (md5-state-buffer-index state) (+ buffer-index amount))
(return-from update-md5-state state)))
(let ((new-index (+ buffer-index amount)))
(when (= new-index 64)
(fill-block-ub8 block buffer 0)
(update-md5-block regs block))
(update-md5-block regs block)
(setq new-index 0))
(when (>= start end)
(setf (md5-state-buffer-index state) new-index)
(incf (md5-state-amount state) length)
(return-from update-md5-state state)))))
;; Handle main-part and new-rest
(etypecase sequence
((simple-array (unsigned-byte 8) (*))