Fix regression in Zlib which was introduced while refactoring the code. See #255
This commit is contained in:
parent
97561315fd
commit
05204025cc
@ -124,15 +124,16 @@ final class InfBlocks {
|
|||||||
int m; // bytes to end of window or read pointer
|
int m; // bytes to end of window or read pointer
|
||||||
|
|
||||||
// copy input/output information to locals (UPDATE macro restores)
|
// copy input/output information to locals (UPDATE macro restores)
|
||||||
|
{
|
||||||
p = z.next_in_index;
|
p = z.next_in_index;
|
||||||
n = z.avail_in;
|
n = z.avail_in;
|
||||||
b = bitb;
|
b = bitb;
|
||||||
k = bitk;
|
k = bitk;
|
||||||
|
}
|
||||||
q = write;
|
{
|
||||||
m = q < read? read - q - 1 : end - q;
|
q = write;
|
||||||
|
m = q < read? read - q - 1 : end - q;
|
||||||
|
}
|
||||||
|
|
||||||
// process input based on current state
|
// process input based on current state
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -160,17 +161,20 @@ final class InfBlocks {
|
|||||||
|
|
||||||
switch (t >>> 1) {
|
switch (t >>> 1) {
|
||||||
case 0: // stored
|
case 0: // stored
|
||||||
|
{
|
||||||
b >>>= 3;
|
b >>>= 3;
|
||||||
k -= 3;
|
k -= 3;
|
||||||
|
}
|
||||||
t = k & 7; // go to byte boundary
|
t = k & 7; // go to byte boundary
|
||||||
|
|
||||||
b >>>= t;
|
{
|
||||||
k -= t;
|
b >>>= t;
|
||||||
|
k -= t;
|
||||||
|
}
|
||||||
mode = LENS; // get length of stored block
|
mode = LENS; // get length of stored block
|
||||||
break;
|
break;
|
||||||
case 1: // fixed
|
case 1: // fixed
|
||||||
|
{
|
||||||
int[] bl = new int[1];
|
int[] bl = new int[1];
|
||||||
int[] bd = new int[1];
|
int[] bd = new int[1];
|
||||||
int[][] tl = new int[1][];
|
int[][] tl = new int[1][];
|
||||||
@ -178,24 +182,30 @@ final class InfBlocks {
|
|||||||
|
|
||||||
InfTree.inflate_trees_fixed(bl, bd, tl, td);
|
InfTree.inflate_trees_fixed(bl, bd, tl, td);
|
||||||
codes.init(bl[0], bd[0], tl[0], 0, td[0], 0);
|
codes.init(bl[0], bd[0], tl[0], 0, td[0], 0);
|
||||||
|
}
|
||||||
|
|
||||||
b >>>= 3;
|
{
|
||||||
k -= 3;
|
b >>>= 3;
|
||||||
|
k -= 3;
|
||||||
|
}
|
||||||
|
|
||||||
mode = CODES;
|
mode = CODES;
|
||||||
break;
|
break;
|
||||||
case 2: // dynamic
|
case 2: // dynamic
|
||||||
|
|
||||||
|
{
|
||||||
b >>>= 3;
|
b >>>= 3;
|
||||||
k -= 3;
|
k -= 3;
|
||||||
|
}
|
||||||
|
|
||||||
mode = TABLE;
|
mode = TABLE;
|
||||||
break;
|
break;
|
||||||
case 3: // illegal
|
case 3: // illegal
|
||||||
|
|
||||||
|
{
|
||||||
b >>>= 3;
|
b >>>= 3;
|
||||||
k -= 3;
|
k -= 3;
|
||||||
|
}
|
||||||
mode = BAD;
|
mode = BAD;
|
||||||
z.msg = "invalid block type";
|
z.msg = "invalid block type";
|
||||||
r = JZlib.Z_DATA_ERROR;
|
r = JZlib.Z_DATA_ERROR;
|
||||||
@ -342,9 +352,10 @@ final class InfBlocks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
b >>>= 14;
|
b >>>= 14;
|
||||||
k -= 14;
|
k -= 14;
|
||||||
|
}
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
mode = BTREE;
|
mode = BTREE;
|
||||||
@ -369,9 +380,10 @@ final class InfBlocks {
|
|||||||
|
|
||||||
blens[border[index ++]] = b & 7;
|
blens[border[index ++]] = b & 7;
|
||||||
|
|
||||||
b >>>= 3;
|
{
|
||||||
k -= 3;
|
b >>>= 3;
|
||||||
|
k -= 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (index < 19) {
|
while (index < 19) {
|
||||||
@ -493,36 +505,36 @@ final class InfBlocks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tb[0] = -1;
|
tb[0] = -1;
|
||||||
|
{
|
||||||
|
int[] bl = new int[1];
|
||||||
|
int[] bd = new int[1];
|
||||||
|
int[] tl = new int[1];
|
||||||
|
int[] td = new int[1];
|
||||||
|
bl[0] = 9; // must be <= 9 for lookahead assumptions
|
||||||
|
bd[0] = 6; // must be <= 9 for lookahead assumptions
|
||||||
|
|
||||||
int[] bl = new int[1];
|
t = table;
|
||||||
int[] bd = new int[1];
|
t = inftree.inflate_trees_dynamic(257 + (t & 0x1f),
|
||||||
int[] tl = new int[1];
|
1 + (t >> 5 & 0x1f), blens, bl, bd, tl, td, hufts,
|
||||||
int[] td = new int[1];
|
z);
|
||||||
bl[0] = 9; // must be <= 9 for lookahead assumptions
|
|
||||||
bd[0] = 6; // must be <= 9 for lookahead assumptions
|
|
||||||
|
|
||||||
t = table;
|
if (t != JZlib.Z_OK) {
|
||||||
t = inftree.inflate_trees_dynamic(257 + (t & 0x1f),
|
if (t == JZlib.Z_DATA_ERROR) {
|
||||||
1 + (t >> 5 & 0x1f), blens, bl, bd, tl, td, hufts,
|
blens = null;
|
||||||
z);
|
mode = BAD;
|
||||||
|
}
|
||||||
|
r = t;
|
||||||
|
|
||||||
if (t != JZlib.Z_OK) {
|
bitb = b;
|
||||||
if (t == JZlib.Z_DATA_ERROR) {
|
bitk = k;
|
||||||
blens = null;
|
z.avail_in = n;
|
||||||
mode = BAD;
|
z.total_in += p - z.next_in_index;
|
||||||
|
z.next_in_index = p;
|
||||||
|
write = q;
|
||||||
|
return inflate_flush(z, r);
|
||||||
}
|
}
|
||||||
r = t;
|
codes.init(bl[0], bd[0], hufts, tl[0], hufts, td[0]);
|
||||||
|
|
||||||
bitb = b;
|
|
||||||
bitk = k;
|
|
||||||
z.avail_in = n;
|
|
||||||
z.total_in += p - z.next_in_index;
|
|
||||||
z.next_in_index = p;
|
|
||||||
write = q;
|
|
||||||
return inflate_flush(z, r);
|
|
||||||
}
|
}
|
||||||
codes.init(bl[0], bd[0], hufts, tl[0], hufts, td[0]);
|
|
||||||
|
|
||||||
mode = CODES;
|
mode = CODES;
|
||||||
case CODES:
|
case CODES:
|
||||||
bitb = b;
|
bitb = b;
|
||||||
|
Loading…
Reference in New Issue
Block a user