Error handling fixes for inflate.

This commit is contained in:
Chris D. Faulhaber 2002-02-17 17:35:18 +00:00
parent 9e9c4443f6
commit efec00ac60
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90775
2 changed files with 14 additions and 8 deletions

View File

@ -252,10 +252,11 @@ int r;
&s->sub.trees.tb, s->hufts, z);
if (t != Z_OK)
{
ZFREE(z, s->sub.trees.blens);
r = t;
if (r == Z_DATA_ERROR)
if (r == Z_DATA_ERROR) {
ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
}
LEAVE
}
s->sub.trees.index = 0;
@ -316,11 +317,12 @@ int r;
t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
s->sub.trees.blens, &bl, &bd, &tl, &td,
s->hufts, z);
ZFREE(z, s->sub.trees.blens);
if (t != Z_OK)
{
if (t == (uInt)Z_DATA_ERROR)
if (t == (uInt)Z_DATA_ERROR) {
ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
}
r = t;
LEAVE
}
@ -332,6 +334,7 @@ int r;
}
s->sub.decode.codes = c;
}
ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
case CODES:
UPDATE

View File

@ -3864,10 +3864,11 @@ int r;
&s->sub.trees.tb, z);
if (t != Z_OK)
{
ZFREE(z, s->sub.trees.blens);
r = t;
if (r == Z_DATA_ERROR)
if (r == Z_DATA_ERROR) {
ZFREE(z, s->sub.trees.blens);
s->mode = BADB;
}
LEAVE
}
s->sub.trees.index = 0;
@ -3932,11 +3933,12 @@ 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)
if (t == (uInt)Z_DATA_ERROR) {
ZFREE(z, s->sub.trees.blens);
s->mode = BADB;
}
r = t;
LEAVE
}
@ -3953,6 +3955,7 @@ int r;
s->sub.decode.tl = tl;
s->sub.decode.td = td;
}
ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
case CODES:
UPDATE