Problems with Zlib - data error

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 20 13:24:15 PDT 2017


On Thursday, 20 April 2017 at 20:19:31 UTC, Era Scarecrow wrote:
> I took the UnCompress example and tried to make use of it, 
> however it breaks midway through my program with nothing more 
> than 'Data Error'.

See the tip of the week here:

http://arsdnet.net/this-week-in-d/2016-apr-24.html

In short, byChunk reuses its buffer, and std.zlib holds on to the 
pointer. That combination leads to corrupted data.


Easiest fix is to .dup the chunk... I don't know of one off the 
top of my head that avoids the allocation using any of the 
std.zlib functions.


More information about the Digitalmars-d-learn mailing list