diff options
Diffstat (limited to 'lib/libz/inffast.c')
-rw-r--r-- | lib/libz/inffast.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/libz/inffast.c b/lib/libz/inffast.c index 86eee4a2992..61a78ee933f 100644 --- a/lib/libz/inffast.c +++ b/lib/libz/inffast.c @@ -1,5 +1,5 @@ /* inffast.c -- process literals and length/distance pairs fast - * Copyright (C) 1995-1996 Mark Adler + * Copyright (C) 1995-1998 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -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 ? |