[Issue 3191] std.zlib.UnCompress errors if buffer is reused

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Feb 11 04:10:38 PST 2016


https://issues.dlang.org/show_bug.cgi?id=3191

Andre <alverste at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alverste at gmail.com

--- Comment #6 from Andre <alverste at gmail.com> ---
(In reply to Stewart Gordon from comment #5)
> (In reply to Justin Whear from comment #3)
> > The DEFLATE decompression algorithm relies on the results of previous
> > blocks, as it tries to reuse the encoding tree.  From the RFC: "Note that a
> > duplicated string reference may refer to a string in a previous block; i.e.,
> > the backward distance may cross one or more block boundaries.
> 
> If I'm not mistaken, deflate blocks are independent of chunks that the
> datastream may be split into for decompression.  (OK, maybe "block" was the
> wrong word in my original bug report.)
> 
> That said,
> (In reply to Justin Whear from comment #4)
> > I should note that some amount of block reuse is possible if the blocks are
> > sufficiently distant; the maximum distance for a back reference is 32,768
> > bytes.
> 
> This says to me that it is a window of 32768 bytes (or maybe 32769 or 32770
> bytes) that needs to be kept in memory at a given time, regardless of block
> or chunk boundaries.  So why did I find that alternating between buffers
> works even if the buffers are much smaller than this?  (Indeed, I've a vague
> recollection of finding that it works if each of the buffers is a single
> byte.)

To your knowledge, is this fixed in std/zlib or etc/c/zlib?
Or did you use a workaround?

--


More information about the Digitalmars-d-bugs mailing list