Skip to content

sequence output stream enters infinite loop when the array needs to be adjusted

sequence-output-stream tries to adjust the array when there is no space left in the vector, but it enters an infinite loop. It is not a regression and the issue is present in both develop and object-streams.

;;; Correctly increments the fill pointer.
(defun reproduce-issue/works ()
  (let* ((array (make-array 4 :fill-pointer 0 :element-type '(unsigned-byte 8)))
         (stream (ext:make-sequence-output-stream array)))
    (write-byte 42 stream)))

;;; Correctly signals an error that array is not adjustable.
(defun reproduce-issue/fails ()
  (let* ((array (make-array 0 :adjustable nil :fill-pointer 0 :element-type '(unsigned-byte 8)))
         (stream (ext:make-sequence-output-stream array)))
    (write-byte 42 stream)))

;;; Loop forever.
(defun reproduce-issue/hangs ()
  (let* ((array (make-array 0 :adjustable t :fill-pointer 0 :element-type '(unsigned-byte 8)))
         (stream (ext:make-sequence-output-stream array)))
    (write-byte 42 stream)))

The issue came up when I was writing an example for #790 (closed). The issue present as of fad7073f (develop head).