GithubHelp home page GithubHelp logo

romangol / zlib-win64 Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 625 KB

Automatically exported from code.google.com/p/zlib-win64

CMake 0.50% Makefile 1.04% C 67.72% SAS 0.13% CLIPS 0.37% Pascal 4.82% Ada 6.15% Assembly 9.75% C# 3.84% C++ 3.12% Batchfile 0.01% DIGITAL Command Language 1.88% Module Management System 0.11% Groff 0.29% Perl 0.27%

zlib-win64's People

Contributors

hanbaj avatar

zlib-win64's Issues

inflate() hangs while uncompressing data

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

Code may compile without warnings but doesn't work!!

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.