[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#45816: (ice-9 suspendable-ports):get-bytevector-some! is broken
From: |
d4ryus |
Subject: |
bug#45816: (ice-9 suspendable-ports):get-bytevector-some! is broken |
Date: |
Tue, 12 Jan 2021 15:19:05 +0100 |
hi,
(ice-9 suspendable-ports):get-bytevector-some! calls bytevector-copy!
with transfer-size (which is a number) as third argument:
...
(define (get-bytevector-some! port bv start count)
(if (zero? count)
0
(call-with-values (lambda () (fill-input port 1 'binary))
(lambda (buf cur buffered)
(if (zero? buffered)
(begin
(set-port-buffer-has-eof?! buf #f)
the-eof-object)
(let ((transfer-size (min count buffered)))
(bytevector-copy! (port-buffer-bytevector buf) cur
transfer-size start buffered)
(set-port-buffer-cur! buf (+ cur transfer-size))
transfer-size))))))
...
The third argument to bytevector-copy! must be the target bytevector,
from the doc:
Scheme Procedure: bytevector-copy! source source-start target target-start len
Copy len bytes from source into target, starting reading from
source-start (a positive index within source) and start writing at
target-start. It is permitted for the source and target regions to
overlap.
I think the correct call is:
(bytevector-copy! (port-buffer-bytevector buf) cur
bv start transfer-size)
A potentional fix is attached.
If you need any additional information, please let me know.
- d4ryus
suspendable-get-bytevector-some-fix.patch
Description: Text document
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#45816: (ice-9 suspendable-ports):get-bytevector-some! is broken,
d4ryus <=