Description: Use system zlib Use system zlib instead of the internal old version of zlib. Forwarded: not-needed Author: Changwoo Ryu Last-Update: 2013-02-02 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ CPP = g++ CC = gcc -OBJ = main.o UnAlz.o UnAlzUtils.o UnAlzBz2decompress.o UnAlzBzip2.o UnAlzbzlib.o zlib/adler32.o zlib/crc32.o zlib/infback.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/zutil.o bzip2/blocksort.o bzip2/compress.o bzip2/crctable.o bzip2/huffman.o bzip2/randtable.o +OBJ = main.o UnAlz.o UnAlzUtils.o UnAlzBz2decompress.o UnAlzBzip2.o UnAlzbzlib.o bzip2/blocksort.o bzip2/compress.o bzip2/crctable.o bzip2/huffman.o bzip2/randtable.o BIN = unalz -LDFLAGS = -CFLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +LDFLAGS = -lz +CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 all: @echo "" --- a/UnAlzBzip2.cpp +++ b/UnAlzBzip2.cpp @@ -10,7 +10,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// //#include "stdafx.h" -#include "zlib/zlib.h" +#include #include "bzip2/bzlib.h" #include "bzip2/bzlib_private.h" #include "UnAlz.h" Description: Use system libbz2 Use system libbz2 instead of the internal old version of libbz2. Forwarded: not-needed Author: Changwoo Ryu Last-Update: 2013-02-02 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ CPP = g++ CC = gcc -OBJ = main.o UnAlz.o UnAlzUtils.o UnAlzBz2decompress.o UnAlzBzip2.o UnAlzbzlib.o bzip2/blocksort.o bzip2/compress.o bzip2/crctable.o bzip2/huffman.o bzip2/randtable.o +OBJ = main.o UnAlz.o UnAlzUtils.o UnAlzBz2decompress.o UnAlzBzip2.o BIN = unalz -LDFLAGS = -lz +LDFLAGS = -lz -lbz2 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 all: --- a/UnAlzBzip2.cpp +++ b/UnAlzBzip2.cpp @@ -11,10 +11,20 @@ //#include "stdafx.h" #include -#include "bzip2/bzlib.h" -#include "bzip2/bzlib_private.h" +#include #include "UnAlz.h" +// from bzlib_private.h of bzip2 +typedef char Char; +typedef unsigned char Bool; +typedef unsigned char UChar; +typedef int Int32; +typedef unsigned int UInt32; +typedef short Int16; +typedef unsigned short UInt16; + +#define True ((Bool)1) +#define False ((Bool)0) typedef struct { CUnAlz* handle; Description: Fix FTBFS with zlib 1.2.7 and gcc 4.7 Introduction of z_crc_t type on zlib 1.2.7 causes a type error on gcc 4.7. . The upstream uses the internal version of old zlib. Forwarded: not-needed Bug-Debian: http://bugs.debian.org/672001 Author: Changwoo Ryu Last-Update: 2013-02-02 --- a/UnAlz.cpp +++ b/UnAlz.cpp @@ -1907,7 +1907,7 @@ void CUnAlz::DecryptingData(int nSize, BYTE* data) //////////////////////////////////////////////////////////////////////////////////////////////////// UINT32 CUnAlz::CRC32(UINT32 l, BYTE c) { - const unsigned long *CRC_TABLE = get_crc_table(); + const z_crc_t *CRC_TABLE = get_crc_table(); return CRC_TABLE[(l ^ c) & 0xff] ^ (l >> 8); } Description: Correct pipe mode Don't do close() or utime() in pipe mode. The file stream is stdout. Forwarded: not-needed Bug-Debian: http://bugs.debian.org/775233 Author: Changwoo Ryu Last-Update: 2015-02-03 diff --git a/UnAlz.cpp b/UnAlz.cpp index ab675dd..c12c037 100755 --- a/UnAlz.cpp +++ b/UnAlz.cpp @@ -794,7 +794,7 @@ BOOL CUnAlz::ExtractCurrentFile(const char* szDestPathName, const char* szDestFi if(m_pFuncCallBack) m_pFuncCallBack(m_posCur->fileName, 0,m_posCur->uncompressedSize,m_pCallbackParam, NULL); ret = ExtractTo(&dest); - if(dest.fp!=NULL) + if(!m_bPipeMode && dest.fp!=NULL) { fclose(dest.fp); // file time setting - from unalz_wcx_01i.zip Description: Check filename length Check if a filename length field is invalid Forwarded: not-needed Bug-Debian: http://bugs.debian.org/775237 Author: Changwoo Ryu Last-Update: 2015-02-03 diff --git a/UnAlz.cpp b/UnAlz.cpp index ab675dd..42b7506 100755 --- a/UnAlz.cpp +++ b/UnAlz.cpp @@ -431,6 +431,11 @@ BOOL CUnAlz::ReadLocalFileheader() zipHeader.uncompressedSize = unalz_le64toh(zipHeader.uncompressedSize); // FILE NAME + if(zipHeader.head.fileNameLength<=0) + { + m_nErr = ERR_INVALID_FILENAME_LENGTH; + return FALSE; + } zipHeader.fileName = (char*)malloc(zipHeader.head.fileNameLength+sizeof(char)); if(zipHeader.fileName==NULL) { Description: Fix file offset overflow on incomplete files Author: Changwoo Ryu Bug-Debian: https://bugs.debian.org/871722 Forwarded: not-needed --- a/UnAlz.cpp +++ b/UnAlz.cpp @@ -1634,7 +1634,11 @@ while(dwRemain) { - dwRead = (UINT32)min(dwRemain, (m_files[m_nCurFile].nFileSize-m_nCurFilePos-m_files[m_nCurFile].nMultivolTailSize)); + INT64 remain = m_files[m_nCurFile].nFileSize - m_nCurFilePos - m_files[m_nCurFile].nMultivolTailSize; + if (remain <= 0) { + m_bIsEOF = TRUE; return FALSE; + } + dwRead = (UINT32)min(dwRemain, remain); if(dwRead==0) { m_bIsEOF = TRUE;return FALSE; }