Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 53871
b: refs/heads/master
c: 39b7ee0
h: refs/heads/master
i:
  53869: caca0cf
  53867: e53167e
  53863: 5a4fe24
  53855: d451c2a
v: v3
  • Loading branch information
Jeremy Fitzhardinge authored and Andi Kleen committed May 2, 2007
1 parent 6596f50 commit a1e3f00
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35c7422649ee7a3d0eb4ebd32c997eeb45f81046
refs/heads/master: 39b7ee06859b07ca5fd4fabb44c4600316532574
61 changes: 41 additions & 20 deletions trunk/lib/inflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,16 +798,19 @@ STATIC int noinline INIT inflate_dynamic(void)
unsigned nb; /* number of bit length codes */
unsigned nl; /* number of literal/length codes */
unsigned nd; /* number of distance codes */
#ifdef PKZIP_BUG_WORKAROUND
unsigned ll[288+32]; /* literal/length and distance code lengths */
#else
unsigned ll[286+30]; /* literal/length and distance code lengths */
#endif
unsigned *ll; /* literal/length and distance code lengths */
register ulg b; /* bit buffer */
register unsigned k; /* number of bits in bit buffer */
int ret;

DEBG("<dyn");

#ifdef PKZIP_BUG_WORKAROUND
ll = malloc(sizeof(*ll) * (288+32)); /* literal/length and distance code lengths */
#else
ll = malloc(sizeof(*ll) * (286+30)); /* literal/length and distance code lengths */
#endif

/* make local bit buffer */
b = bb;
k = bk;
Expand All @@ -828,7 +831,10 @@ DEBG("<dyn");
#else
if (nl > 286 || nd > 30)
#endif
return 1; /* bad lengths */
{
ret = 1; /* bad lengths */
goto out;
}

DEBG("dyn1 ");

Expand All @@ -850,7 +856,8 @@ DEBG("dyn2 ");
{
if (i == 1)
huft_free(tl);
return i; /* incomplete code set */
ret = i; /* incomplete code set */
goto out;
}

DEBG("dyn3 ");
Expand All @@ -872,8 +879,10 @@ DEBG("dyn3 ");
NEEDBITS(2)
j = 3 + ((unsigned)b & 3);
DUMPBITS(2)
if ((unsigned)i + j > n)
return 1;
if ((unsigned)i + j > n) {
ret = 1;
goto out;
}
while (j--)
ll[i++] = l;
}
Expand All @@ -882,8 +891,10 @@ DEBG("dyn3 ");
NEEDBITS(3)
j = 3 + ((unsigned)b & 7);
DUMPBITS(3)
if ((unsigned)i + j > n)
return 1;
if ((unsigned)i + j > n) {
ret = 1;
goto out;
}
while (j--)
ll[i++] = 0;
l = 0;
Expand All @@ -893,8 +904,10 @@ DEBG("dyn3 ");
NEEDBITS(7)
j = 11 + ((unsigned)b & 0x7f);
DUMPBITS(7)
if ((unsigned)i + j > n)
return 1;
if ((unsigned)i + j > n) {
ret = 1;
goto out;
}
while (j--)
ll[i++] = 0;
l = 0;
Expand Down Expand Up @@ -923,7 +936,8 @@ DEBG("dyn5b ");
error("incomplete literal tree");
huft_free(tl);
}
return i; /* incomplete code set */
ret = i; /* incomplete code set */
goto out;
}
DEBG("dyn5c ");
bd = dbits;
Expand All @@ -939,15 +953,18 @@ DEBG("dyn5d ");
huft_free(td);
}
huft_free(tl);
return i; /* incomplete code set */
ret = i; /* incomplete code set */
goto out;
#endif
}

DEBG("dyn6 ");

/* decompress until an end-of-block code */
if (inflate_codes(tl, td, bl, bd))
return 1;
if (inflate_codes(tl, td, bl, bd)) {
ret = 1;
goto out;
}

DEBG("dyn7 ");

Expand All @@ -956,10 +973,14 @@ DEBG("dyn7 ");
huft_free(td);

DEBG(">");
return 0;
ret = 0;
out:
free(ll);
return ret;

underrun:
return 4; /* Input underrun */
underrun:
ret = 4; /* Input underrun */
goto out;
}


Expand Down

0 comments on commit a1e3f00

Please sign in to comment.