zlib 1.0.5

This commit is contained in:
Mark Adler
2011-09-09 23:17:17 -07:00
parent ff11b0a61f
commit ebd3c2c0e7
10 changed files with 61 additions and 49 deletions

View File

@@ -1,5 +1,5 @@
/* infblock.c -- interpret and process block types to last block
* Copyright (C) 1995-1996 Mark Adler
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -12,7 +12,7 @@
struct inflate_codes_state {int dummy;}; /* for buggy compilers */
/* Table for deflate from PKZIP's appnote.txt. */
local uInt border[] = { /* Order of the bit length code lengths */
local const uInt border[] = { /* Order of the bit length code lengths */
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
/*
@@ -224,8 +224,6 @@ int r;
}
#endif
t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
if (t < 19)
t = 19;
if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL)
{
r = Z_MEM_ERROR;
@@ -249,6 +247,7 @@ int r;
&s->sub.trees.tb, z);
if (t != Z_OK)
{
ZFREE(z, s->sub.trees.blens);
r = t;
if (r == Z_DATA_ERROR)
s->mode = BAD;
@@ -287,6 +286,8 @@ int r;
if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||
(c == 16 && i < 1))
{
inflate_trees_free(s->sub.trees.tb, z);
ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
z->msg = (char*)"invalid bit length repeat";
r = Z_DATA_ERROR;
@@ -314,6 +315,7 @@ int r;
#endif
t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
s->sub.trees.blens, &bl, &bd, &tl, &td, z);
ZFREE(z, s->sub.trees.blens);
if (t != Z_OK)
{
if (t == (uInt)Z_DATA_ERROR)
@@ -330,7 +332,6 @@ int r;
r = Z_MEM_ERROR;
LEAVE
}
ZFREE(z, s->sub.trees.blens);
s->sub.decode.codes = c;
s->sub.decode.tl = tl;
s->sub.decode.td = td;