- fix another long file support problem

This commit is contained in:
Ivana Varekova 2008-01-23 13:30:46 +00:00
parent 6369f01b98
commit 67bdb8a40e
3 changed files with 125 additions and 5 deletions

115
unzip-5.52-4GB_types.patch Normal file
View File

@ -0,0 +1,115 @@
diff -up unzip-5.52/globals.h.pom unzip-5.52/globals.h
--- unzip-5.52/globals.h.pom 2008-01-23 14:20:11.000000000 +0100
+++ unzip-5.52/globals.h 2008-01-23 14:20:11.000000000 +0100
@@ -247,9 +247,9 @@ typedef struct Globals {
#else
int zipfd; /* zipfile file handle */
#endif
- Z_OFF_T ziplen;
- Z_OFF_T cur_zipfile_bufstart; /* extract_or_test, readbuf, ReadByte */
- Z_OFF_T extra_bytes; /* used in unzip.c, misc.c */
+ ulg ziplen;
+ ulg cur_zipfile_bufstart; /* extract_or_test, readbuf, ReadByte */
+ ulg extra_bytes; /* used in unzip.c, misc.c */
uch *extra_field; /* Unix, VMS, Mac, OS/2, Acorn, ... */
uch *hold;
diff -up unzip-5.52/list.c.pom unzip-5.52/list.c
--- unzip-5.52/list.c.pom 2008-01-23 14:20:11.000000000 +0100
+++ unzip-5.52/list.c 2008-01-23 14:20:11.000000000 +0100
@@ -62,12 +62,12 @@
"%8lu %-7s%8lu %4s %02u%c%02u%c%02u %02u:%02u %08lx %c";
static ZCONST char Far LongFileTrailer[] =
"-------- ------- --- \
- -------\n%8ju %8ju %4s %lu file%s\n";
+ -------\n%8llu %8llu %4s %lu file%s\n";
#ifdef OS2_EAS
static ZCONST char Far ShortHdrStats[] =
"%9lu %6lu %6lu %02u%c%02u%c%02u %02u:%02u %c";
static ZCONST char Far ShortFileTrailer[] = " -------- ----- ----- \
- -------\n%9ju %6lu %6lu %lu file%s\n";
+ -------\n%9llu %6lu %6lu %lu file%s\n";
static ZCONST char Far OS2ExtAttrTrailer[] =
"%lu file%s %lu bytes of OS/2 extended attributes attached.\n";
static ZCONST char Far OS2ACLTrailer[] =
diff -up unzip-5.52/unzpriv.h.pom unzip-5.52/unzpriv.h
--- unzip-5.52/unzpriv.h.pom 2008-01-23 14:20:11.000000000 +0100
+++ unzip-5.52/unzpriv.h 2008-01-23 14:23:21.000000000 +0100
@@ -1903,7 +1903,7 @@ void defer_leftover_input OF((__GPRO
unsigned readbuf OF((__GPRO__ char *buf, register unsigned len));
int readbyte OF((__GPRO));
int fillinbuf OF((__GPRO));
-int seek_zipf OF((__GPRO__ Z_OFF_T abs_offset));
+int seek_zipf OF((__GPRO__ ulg abs_offset));
#ifdef FUNZIP
int flush OF((__GPRO__ ulg size)); /* actually funzip.c */
#else
diff -up unzip-5.52/fileio.c.pom unzip-5.52/fileio.c
--- unzip-5.52/fileio.c.pom 2008-01-23 14:20:11.000000000 +0100
+++ unzip-5.52/fileio.c 2008-01-23 14:20:11.000000000 +0100
@@ -669,7 +669,7 @@ int fillinbuf(__G) /* like readbyte() ex
int seek_zipf(__G__ abs_offset)
__GDEF
- Z_OFF_T abs_offset;
+ ulg abs_offset;
{
/*
* Seek to the block boundary of the block which includes abs_offset,
@@ -690,9 +690,9 @@ int seek_zipf(__G__ abs_offset)
* PK_EOF if seeking past end of zipfile
* PK_OK when seek was successful
*/
- Z_OFF_T request = abs_offset + G.extra_bytes;
- Z_OFF_T inbuf_offset = request % INBUFSIZ;
- Z_OFF_T bufstart = request - inbuf_offset;
+ ulg request = abs_offset + G.extra_bytes;
+ ulg inbuf_offset = request % INBUFSIZ;
+ ulg bufstart = request - inbuf_offset;
if (request > (Z_OFF_T) MAX_ZIP_SIZE) {
Info(slide, 1, ((char *)slide, LoadFarStringSmall(SeekMsg),
diff -up unzip-5.52/process.c.pom unzip-5.52/process.c
--- unzip-5.52/process.c.pom 2008-01-23 14:20:11.000000000 +0100
+++ unzip-5.52/process.c 2008-01-23 14:20:11.000000000 +0100
@@ -915,7 +915,7 @@ static int find_ecrec(__G__ searchlen)
long searchlen;
{
int i, numblks, found=FALSE;
- Z_OFF_T tail_len;
+ ulg tail_len;
ec_byte_rec byterec;
diff -up unzip-5.52/extract.c.pom unzip-5.52/extract.c
--- unzip-5.52/extract.c.pom 2008-01-23 14:20:11.000000000 +0100
+++ unzip-5.52/extract.c 2008-01-23 14:20:11.000000000 +0100
@@ -301,16 +301,16 @@ int extract_or_test_files(__G) /* ret
__GDEF
{
unsigned i, j;
- Z_OFF_T cd_bufstart;
+ ulg cd_bufstart;
uch *cd_inptr;
int cd_incnt;
ulg filnum=0L, blknum=0L;
int reached_end, no_endsig_found;
int error, error_in_archive=PK_COOL;
int *fn_matched=NULL, *xn_matched=NULL;
- Z_OFF_T members_processed;
+ ulg members_processed;
ulg num_skipped=0L, num_bad_pwd=0L;
- Z_OFF_T old_extra_bytes = 0L;
+ ulg old_extra_bytes = 0L;
#ifdef SET_DIR_ATTRIB
unsigned num_dirs=0;
direntry *dirlist=(direntry *)NULL, **sorted_dirlist=(direntry **)NULL;
@@ -908,7 +908,7 @@ static int extract_or_test_entrylist(__G
unsigned i;
int renamed, query;
int skip_entry;
- Z_OFF_T bufstart, inbuf_offset, request;
+ ulg bufstart, inbuf_offset, request;
int error, errcode;
/* possible values for local skip_entry flag: */

View File

@ -23,7 +23,7 @@
"debug: bufstart = %ld, cur_zipfile_bufstart = %ld\n",
(long)bufstart, (long)G.cur_zipfile_bufstart));
- if (request < 0) {
+ if ((request < 0) || (request > MAX_ZIP_SIZE)) { /* >2^32-8193 */
+ if (request > MAX_ZIP_SIZE) { /* >2^32-8193 */
+ printf("retry - request = 0x%lu\n", (ulg)request);
Info(slide, 0x401, ((char *)slide, LoadFarStringSmall(SeekMsg),
G.zipfn, LoadFarString(ReportMsg)));
@ -44,7 +44,7 @@
# for any platform. Change "-O" to "-O3" or whatever, as desired...
linux_noasm: unix_make
- $(MAKE) unzips CC=gcc LD=gcc CF="$(RPM_OPT_FLAGS) -D_GNU_SOURCE -Wall -I. $(LOC)"
+ $(MAKE) unzips CC=gcc LD=gcc CF="$(RPM_OPT_FLAGS) -D_LARGEFILE64_SOUCRE -D_GNU_SOURCE -Wall -I. $(LOC)"
+ $(MAKE) unzips CC=gcc LD=gcc CF="$(RPM_OPT_FLAGS) -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -Wall -I. $(LOC)"
# Linux with lcc compiler: __inline__ (stat.h) not recognized, and must edit
# /usr/include/gnu/types.h to get rid of "long long" if __LCC__ defined. -O3
@ -178,7 +178,7 @@
Z_OFF_T bufstart = request - inbuf_offset;
- if (request < 0) {
+ if (request < 0) {
+ if (request > (Z_OFF_T) MAX_ZIP_SIZE) {
Info(slide, 1, ((char *)slide, LoadFarStringSmall(SeekMsg),
G.zipfn, LoadFarString(ReportMsg)));
return(PK_BADERR);

View File

@ -1,7 +1,7 @@
Summary: A utility for unpacking zip files
Name: unzip
Version: 5.52
Release: 6%{?dist}
Release: 7%{?dist}
License: BSD
Group: Applications/Archiving
Source: ftp://ftp.info-zip.org/pub/infozip/src/unzip552.tar.gz
@ -15,6 +15,7 @@ Patch9: unzip-5.52-long-filename.patch
Patch10: unzip-5.52-makefile.patch
Patch11: unzip-5.52-open.patch
Patch12: unzip-5.52-4GB3.patch
Patch13: unzip-5.52-4GB_types.patch
URL: http://www.info-zip.org/pub/infozip/UnZip.html
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -41,6 +42,7 @@ a zip archive.
%patch10 -p1 -b .make
%patch11 -p1 -b .open
%patch12 -p1 -b .4GB3
%patch13 -p1 -b .4BG4
ln -s unix/Makefile Makefile
%build
@ -61,8 +63,11 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/*/*
%changelog
* Wed Jan 23 2008 Ivana Varekova <varekova@redhat.com> - 5.52-7
- fix another long file support problem
* Tue Jan 22 2008 Ivana Varekova <varekova@redhat.com> - 5.52-6
- add >4GB patch (#429674)
- add 4GB patch (#429674)
* Tue Sep 4 2007 Ivana Varekova <varekova@redhat.com> - 5.52-5
- fix open call