This patch is relative to gzip 1.2.4. It allows uncompressing files
larger than 4 gigabytes. Files already compressed without the patch
are correct; the patch is needed only for decompression with gunzip.
Decompression with zcat outputs the correct data plus an error message
"length error" that you can ignore.

The patched unzip.c is also provided separately in 4g-patch.tar if you
don't have the 'patch' program needed to apply this patch.  To create
a new version of gzip, download gzip-1.2.4.tar.gz and 4g-patch.tar,
then do:

  gunzip < gzip-1.2.4.tar.gz | tar xf -
  cd gzip-1.2.4
  tar xf ../4g-patch.tar
  ./configure
  make test

Jean-loup Gailly
jloup@gzip.org

*** unzip.c~	Wed Jul  9 17:51:24 1997
--- unzip.c	Sun Jul 21 18:38:11 1996
***************
*** 35,40 ****
--- 34,40 ----
  #define LOCEXT 28               /* offset of extra field length */
  #define LOCHDR 30               /* size of local header, including sig */
  #define EXTHDR 16               /* size of extended local header, inc sig */
+ #define RAND_HEAD_LEN  12       /* length of encryption random header */
  
  
  /* Globals */
***************
*** 103,108 ****
--- 103,109 ----
      ulg orig_len = 0;       /* original uncompressed length */
      int n;
      uch buf[EXTHDR];        /* extended local header */
+     int err = OK;
  
      ifd = in;
      ofd = out;
***************
*** 136,144 ****
  	}
  	while (n--) {
  	    uch c = (uch)get_byte();
- #ifdef CRYPT
- 	    if (decrypt) zdecode(c);
- #endif
  	    put_ubyte(c);
  	}
  	flush_window();
--- 137,142 ----
***************
*** 172,181 ****
  
      /* Validate decompression */
      if (orig_crc != updcrc(outbuf, 0)) {
! 	error("invalid compressed data--crc error");
      }
!     if (orig_len != (ulg)bytes_out) {
! 	error("invalid compressed data--length error");
      }
  
      /* Check if there are more entries in a pkzip file */
--- 170,183 ----
  
      /* Validate decompression */
      if (orig_crc != updcrc(outbuf, 0)) {
! 	fprintf(stderr, "\n%s: %s: invalid compressed data--crc error\n",
! 		progname, ifname);
! 	err = ERROR;
      }
!     if (((orig_len - (ulg)bytes_out) & 0x0ffffffffL) != 0) {
! 	fprintf(stderr, "\n%s: %s: invalid compressed data--length error\n",
! 		progname, ifname);
! 	err = ERROR;
      }
  
      /* Check if there are more entries in a pkzip file */
***************
*** 189,199 ****
  	    fprintf(stderr,
  		    "%s: %s has more than one entry -- unchanged\n",
  		    progname, ifname);
! 	    exit_code = ERROR;
! 	    ext_header = pkzip = 0;
! 	    return ERROR;
  	}
      }
      ext_header = pkzip = 0; /* for next file */
!     return OK;
  }
--- 191,202 ----
  	    fprintf(stderr,
  		    "%s: %s has more than one entry -- unchanged\n",
  		    progname, ifname);
! 	    err = ERROR;
  	}
      }
      ext_header = pkzip = 0; /* for next file */
!     if (err == OK) return OK;
!     exit_code = ERROR;
!     if (!test) abort_gzip();
!     return err;
  }
