Sunjoong Lee <sunjo...@gmail.com> writes: > Ian had made a new patch for Chunked > Encoding, http://lists.gnu.org/archive/html/guile-devel/2012-05/msg00040.html > ; thanks Ian. But I suspect it has a bug. > > make-chunked-input-port use bytevector-copy! in read!. I saw the crash like > this; > ERROR: In procedure bytevector-copy!: > ERROR: Value out of range 0 to 4294967295: -5915 > > I can't tell the url of the web page made that crash because I had seen it in > my testing login to that page but can tell you that was not written by > english and the charset of > that is not UTF-8. I suspect the cause of the crash be in using > bytevector-copy!.
Odd that I hadn't noticed this issue when I was testing. The problem occurs in the case where the number to be read is less than the remaining size of a chunk. I was updating the count with the buffer size, rather than the difference, which leads to negative values on the recursive call. There was also a mistake in the same case in updating the buffer-pointer. Thanks for pointing this out, and if you have other comments on the implementation (and the close-port issue), I'll be happy to have them. -- Ian Price "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled"