diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:20:15 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:20:15 -0700 |
commit | c34c1fcbb19852ca35216ad66276f4f86af3fc22 (patch) | |
tree | 4bd0972d6c682e474725eca372f6551d539f8768 /inffast.c | |
parent | 02b6cf579f02ec78c052735020a5d3c5723ed641 (diff) | |
download | zlib-c34c1fcbb19852ca35216ad66276f4f86af3fc22.tar.gz |
zlib 1.1.2v1.1.2
Diffstat (limited to 'inffast.c')
-rw-r--r-- | inffast.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -13,14 +13,12 @@ struct inflate_codes_state {int dummy;}; /* for buggy compilers */ /* simplify the use of the inflate_huft type with some defines */ -#define base more.Base -#define next more.Next #define exop word.what.Exop #define bits word.what.Bits /* macros for bit input with no checking and for returning unused bytes */ #define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}} -#define UNGRAB {n+=(c=k>>3);p-=c;k&=7;} +#define UNGRAB {c=z->avail_in-n;c=(k>>3)<c?k>>3:c;n+=c;p-=c;k-=c<<3;} /* Called with number of bytes left to write in window at least 258 (the maximum string length) and number of input bytes available @@ -120,7 +118,10 @@ z_streamp z; break; } else if ((e & 64) == 0) - e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop; + { + t += t->base; + e = (t += ((uInt)b & inflate_mask[e]))->exop; + } else { z->msg = (char*)"invalid distance code"; @@ -133,7 +134,8 @@ z_streamp z; } if ((e & 64) == 0) { - if ((e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop) == 0) + t += t->base; + if ((e = (t += ((uInt)b & inflate_mask[e]))->exop) == 0) { DUMPBITS(t->bits) Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? |