romangol / zlib-win64 Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/zlib-win64
Automatically exported from code.google.com/p/zlib-win64
I have compiled this project with Microsoft Visual Studio 2010 and used in my
project as a static lib. But I found out that inflate() hangs when I try to
uncompress data. Detailed information here:
http://stackoverflow.com/questions/29165128/zlib-inflate-hangs-while-uncompressi
ng-buffer
Original issue reported on code.google.com by [email protected]
on 21 Mar 2015 at 1:00
I downloaded this project because I wanted a zlib under 64 bit on windows.
My recommendation to anyone else thinking of using this is don't.
Unfortunately the changes in the code to remove warnings are simply incorrect.
The clearest example of this is to look at the difference between inflate.c in
this version and the downstream 1.2.7 inflate.c
this version
/* Get a byte of input into the bit accumulator, or return from inflate()
if there is no input available. */
#define PULLBYTE() \
if (have == 0) goto inf_leave; \
have--; \
hold += (unsigned long)(*next++) << bits; \
bits += 8;
/* Assure that there are at least n bits in the bit accumulator. If there is
not enough available input to do that, then return from inflate(). */
#define NEEDBITS(n) \
while (bits < (unsigned)(n)) \
PULLBYTE();
Equivalent Source from original 1.2.7
/* Get a byte of input into the bit accumulator, or return from inflate()
if there is no input available. */
#define PULLBYTE() \
do { \
if (have == 0) goto inf_leave; \
have--; \
hold += (unsigned long)(*next++) << bits; \
bits += 8; \
} while (0)
/* Assure that there are at least n bits in the bit accumulator. If there is
not enough available input to do that, then return from inflate(). */
#define NEEDBITS(n) \
do { \
while (bits < (unsigned)(n)) \
PULLBYTE(); \
} while (0)
As can be seen the do { } while ( 0 ) have been removed (probably because they
warn about conditional is constant).
They have been removed incorrectly - since the macro expansion for say
PULLBYTE() is no longer a single statement.
This means that the first case of this macro being used in inflate.c
NEEDBITS(16);
is actually translated by the macro expansion to the following fragment
while (bits < (unsigned)(n))
if (have == 0) goto inf_leave;
which is an infinite loop.
This leads me to suspect that this code has not been tested at all since any
call to inflate() will end up in an infinite loop.
I haven't gone any further through this code having seen this - so there may
well be other equally as wrong changes.
Original issue reported on code.google.com by [email protected]
on 13 May 2014 at 2:43
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.