[Zlib-devel] error when uncompressing in 16 bits compile (Bug in zLib 1.14 only !)
Mark Adler
madler at alumni.caltech.edu
Mon May 5 08:02:01 EDT 2003
On Monday, May 5, 2003, at 03:53 AM, Gilles Vollant wrote:
> John Sørensen [john at barcode.dk]wrote me about a problem :
> When he uncompress a large file (bigger than 32.950 bytes) he get CRC
> error in uncompressing.
>
> He had the problem while compile minizip code or minigzip (to
> uncompress a .zip or a .gz)
>
> I send him several zLib version (1.04, 1.13 and latest beta 1.2.0.1),
> and he has the bug only in 1.14
>
> 1.14 is the actual official version, so I want inform the list about
> the problem
This is a known problem. The patch to fix this is below.
mark
*** infcodes.114.c Mon Mar 11 05:16:01 2002
--- infcodes.c Fri Mar 15 01:59:28 2002
***************
*** 197,204 ****
c->mode = COPY;
case COPY: /* o: copying bytes in window, waiting for
space */
f = q - c->sub.copy.dist;
! while (f < s->window) /* modulo window size-"while"
instead */
! f += s->end - s->window; /* of "if" handles invalid
distances */
while (c->len)
{
NEEDOUT
--- 197,204 ----
c->mode = COPY;
case COPY: /* o: copying bytes in window, waiting for
space */
f = q - c->sub.copy.dist;
! while (f < s->window || f >= s->end) /* get pointer in
window */
! f += s->end - s->window;
while (c->len)
{
NEEDOUT
*** inffast.114.c Mon Mar 11 05:16:01 2002
--- inffast.c Fri Mar 15 01:58:46 2002
***************
*** 94,104 ****
/* do the copy */
m -= c;
r = q - d;
! if (r < s->window) /* wrap if needed */
{
do {
r += s->end - s->window; /* force pointer in
window */
! } while (r < s->window); /* covers invalid
distances */
e = s->end - r;
if (c > e)
{
--- 94,104 ----
/* do the copy */
m -= c;
r = q - d;
! if ((uInt)(q - s->window) < d) /* wrap if needed */
{
do {
r += s->end - s->window; /* force pointer in
window */
! } while (r < s->window || r >= s->end);
e = s->end - r;
if (c > e)
{
More information about the Zlib-devel
mailing list