Silence some compilation warnings.
This commit is contained in:
@@ -352,6 +352,7 @@ namespace MyLzma {
|
|||||||
|
|
||||||
struct InStream: public ISequentialInStream, public CMyUnknownImp
|
struct InStream: public ISequentialInStream, public CMyUnknownImp
|
||||||
{
|
{
|
||||||
|
virtual ~InStream() { }
|
||||||
MY_UNKNOWN_IMP
|
MY_UNKNOWN_IMP
|
||||||
const Byte *b_buf; size_t b_size; size_t b_pos;
|
const Byte *b_buf; size_t b_size; size_t b_pos;
|
||||||
void Init(const Byte *data, size_t size) {
|
void Init(const Byte *data, size_t size) {
|
||||||
@@ -372,6 +373,7 @@ STDMETHODIMP InStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
|||||||
|
|
||||||
struct OutStream : public ISequentialOutStream, public CMyUnknownImp
|
struct OutStream : public ISequentialOutStream, public CMyUnknownImp
|
||||||
{
|
{
|
||||||
|
virtual ~OutStream() { }
|
||||||
MY_UNKNOWN_IMP
|
MY_UNKNOWN_IMP
|
||||||
Byte *b_buf; size_t b_size; size_t b_pos; bool overflow;
|
Byte *b_buf; size_t b_size; size_t b_pos; bool overflow;
|
||||||
void Init(Byte *data, size_t size) {
|
void Init(Byte *data, size_t size) {
|
||||||
@@ -397,6 +399,7 @@ STDMETHODIMP OutStream::Write(const void *data, UInt32 size, UInt32 *processedSi
|
|||||||
|
|
||||||
struct ProgressInfo : public ICompressProgressInfo, public CMyUnknownImp
|
struct ProgressInfo : public ICompressProgressInfo, public CMyUnknownImp
|
||||||
{
|
{
|
||||||
|
virtual ~ProgressInfo() { }
|
||||||
MY_UNKNOWN_IMP
|
MY_UNKNOWN_IMP
|
||||||
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
|
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
|
||||||
upx_callback_p cb;
|
upx_callback_p cb;
|
||||||
|
|||||||
+2
-2
@@ -98,7 +98,7 @@ static int F(Filter *f)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if (W_CTO != 0)
|
#if (W_CTO != 0)
|
||||||
assert((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) != cto8); // this should not happen
|
assert((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) != (unsigned) cto8); // this should not happen
|
||||||
#endif
|
#endif
|
||||||
lastnoncall = ic;
|
lastnoncall = ic;
|
||||||
noncalls++;
|
noncalls++;
|
||||||
@@ -133,7 +133,7 @@ static int U(Filter *f)
|
|||||||
|
|
||||||
for (ic = 0; ic<=size4; ic+=4) if (COND(b,ic)) {
|
for (ic = 0; ic<=size4; ic+=4) if (COND(b,ic)) {
|
||||||
unsigned const word = get_be32(b+ic);
|
unsigned const word = get_be32(b+ic);
|
||||||
if ((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) == f->cto) {
|
if ((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) == (unsigned) f->cto) {
|
||||||
unsigned const jc = word & (~(~0u<<(26 - W_CTO)) & (~0u<<2));
|
unsigned const jc = word & (~(~0u<<(26 - W_CTO)) & (~0u<<2));
|
||||||
set_be32(b+ic, (0xfc000003&word)|(0x03fffffc&(jc-ic-addvalue)));
|
set_be32(b+ic, (0xfc000003&word)|(0x03fffffc&(jc-ic-addvalue)));
|
||||||
f->calls++;
|
f->calls++;
|
||||||
|
|||||||
@@ -1748,6 +1748,8 @@ extern "C" {
|
|||||||
# define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-!(e)];}
|
# define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-!(e)];}
|
||||||
# elif (ACC_CC_DMC || ACC_CC_PACIFICC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
# elif (ACC_CC_DMC || ACC_CC_PACIFICC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||||
# define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
|
# define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
|
||||||
|
# elif (ACC_CC_GNUC >= 0x040700ul) && defined(__cplusplus)
|
||||||
|
# define ACC_COMPILE_TIME_ASSERT(e) {enum {__acc_cta_e=1/!!(e)} __attribute__((__unused__));}
|
||||||
# elif (ACC_CC_GNUC >= 0x040700ul)
|
# elif (ACC_CC_GNUC >= 0x040700ul)
|
||||||
# define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-2*!(e)] __attribute__((__unused__));}
|
# define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-2*!(e)] __attribute__((__unused__));}
|
||||||
# elif (ACC_CC_MSC && (_MSC_VER < 900))
|
# elif (ACC_CC_MSC && (_MSC_VER < 900))
|
||||||
|
|||||||
+11
-11
@@ -102,7 +102,7 @@ PackLinuxElf32::checkEhdr(Elf32_Ehdr const *ehdr) const
|
|||||||
int const type = get_te16(&ehdr->e_type);
|
int const type = get_te16(&ehdr->e_type);
|
||||||
if (type != Elf32_Ehdr::ET_EXEC && type != Elf32_Ehdr::ET_DYN)
|
if (type != Elf32_Ehdr::ET_EXEC && type != Elf32_Ehdr::ET_DYN)
|
||||||
return 2;
|
return 2;
|
||||||
if (get_te16(&ehdr->e_machine) != e_machine)
|
if (get_te16(&ehdr->e_machine) != (unsigned) e_machine)
|
||||||
return 3;
|
return 3;
|
||||||
if (get_te32(&ehdr->e_version) != Elf32_Ehdr::EV_CURRENT)
|
if (get_te32(&ehdr->e_version) != Elf32_Ehdr::EV_CURRENT)
|
||||||
return 4;
|
return 4;
|
||||||
@@ -135,7 +135,7 @@ int
|
|||||||
PackLinuxElf64::checkEhdr(Elf64_Ehdr const *ehdr) const
|
PackLinuxElf64::checkEhdr(Elf64_Ehdr const *ehdr) const
|
||||||
{
|
{
|
||||||
const unsigned char * const buf = ehdr->e_ident;
|
const unsigned char * const buf = ehdr->e_ident;
|
||||||
unsigned osabi0 = buf[Elf32_Ehdr::EI_OSABI];
|
unsigned char osabi0 = buf[Elf32_Ehdr::EI_OSABI];
|
||||||
if (0==osabi0) {
|
if (0==osabi0) {
|
||||||
osabi0 = opt->o_unix.osabi0;
|
osabi0 = opt->o_unix.osabi0;
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ PackLinuxElf64::checkEhdr(Elf64_Ehdr const *ehdr) const
|
|||||||
int const type = get_te16(&ehdr->e_type);
|
int const type = get_te16(&ehdr->e_type);
|
||||||
if (type != Elf64_Ehdr::ET_EXEC && type != Elf64_Ehdr::ET_DYN)
|
if (type != Elf64_Ehdr::ET_EXEC && type != Elf64_Ehdr::ET_DYN)
|
||||||
return 2;
|
return 2;
|
||||||
if (get_te16(&ehdr->e_machine) != e_machine)
|
if (get_te16(&ehdr->e_machine) != (unsigned) e_machine)
|
||||||
return 3;
|
return 3;
|
||||||
if (get_te32(&ehdr->e_version) != Elf64_Ehdr::EV_CURRENT)
|
if (get_te32(&ehdr->e_version) != Elf64_Ehdr::EV_CURRENT)
|
||||||
return 4;
|
return 4;
|
||||||
@@ -1241,7 +1241,7 @@ bool PackLinuxElf32::canPack()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned osabi0 = u.buf[Elf32_Ehdr::EI_OSABI];
|
unsigned char osabi0 = u.buf[Elf32_Ehdr::EI_OSABI];
|
||||||
// The first PT_LOAD32 must cover the beginning of the file (0==p_offset).
|
// The first PT_LOAD32 must cover the beginning of the file (0==p_offset).
|
||||||
Elf32_Phdr const *phdr = (Elf32_Phdr const *)(u.buf + e_phoff);
|
Elf32_Phdr const *phdr = (Elf32_Phdr const *)(u.buf + e_phoff);
|
||||||
note_size = 0;
|
note_size = 0;
|
||||||
@@ -2041,7 +2041,7 @@ void PackLinuxElf32::pack1(OutputFile *fo, Filter & /*ft*/)
|
|||||||
//set the shstrtab
|
//set the shstrtab
|
||||||
sec_strndx = &shdr[ehdri.e_shstrndx];
|
sec_strndx = &shdr[ehdri.e_shstrndx];
|
||||||
|
|
||||||
char *strtab = new char[sec_strndx->sh_size];
|
char *strtab = new char[(unsigned) sec_strndx->sh_size];
|
||||||
fi->seek(0,SEEK_SET);
|
fi->seek(0,SEEK_SET);
|
||||||
fi->seek(sec_strndx->sh_offset,SEEK_SET);
|
fi->seek(sec_strndx->sh_offset,SEEK_SET);
|
||||||
fi->readx(strtab,sec_strndx->sh_size);
|
fi->readx(strtab,sec_strndx->sh_size);
|
||||||
@@ -2050,7 +2050,7 @@ void PackLinuxElf32::pack1(OutputFile *fo, Filter & /*ft*/)
|
|||||||
|
|
||||||
Elf32_Shdr const *buildid = elf_find_section_name(".note.gnu.build-id");
|
Elf32_Shdr const *buildid = elf_find_section_name(".note.gnu.build-id");
|
||||||
if (buildid) {
|
if (buildid) {
|
||||||
unsigned char *data = new unsigned char[buildid->sh_size];
|
unsigned char *data = new unsigned char[(unsigned) buildid->sh_size];
|
||||||
memset(data,0,buildid->sh_size);
|
memset(data,0,buildid->sh_size);
|
||||||
fi->seek(0,SEEK_SET);
|
fi->seek(0,SEEK_SET);
|
||||||
fi->seek(buildid->sh_offset,SEEK_SET);
|
fi->seek(buildid->sh_offset,SEEK_SET);
|
||||||
@@ -2059,7 +2059,7 @@ void PackLinuxElf32::pack1(OutputFile *fo, Filter & /*ft*/)
|
|||||||
buildid_data = data;
|
buildid_data = data;
|
||||||
|
|
||||||
o_elf_shnum = 3;
|
o_elf_shnum = 3;
|
||||||
memset(&shdrout.shdr,0,sizeof(shdrout));
|
memset(&shdrout,0,sizeof(shdrout));
|
||||||
|
|
||||||
//setup the build-id
|
//setup the build-id
|
||||||
memcpy(&shdrout.shdr[1],buildid, sizeof(shdrout.shdr[1]));
|
memcpy(&shdrout.shdr[1],buildid, sizeof(shdrout.shdr[1]));
|
||||||
@@ -2113,7 +2113,7 @@ void PackLinuxElf32armLe::pack1(OutputFile *fo, Filter &ft)
|
|||||||
}
|
}
|
||||||
// Fighting over .e_ident[EI_ABIVERSION]: Debian armhf is latest culprit.
|
// Fighting over .e_ident[EI_ABIVERSION]: Debian armhf is latest culprit.
|
||||||
// So copy from input to output; but see PackLinuxElf32::generateElfHdr
|
// So copy from input to output; but see PackLinuxElf32::generateElfHdr
|
||||||
memcpy(&h3.ehdr.e_ident, &ehdri.e_ident, sizeof(ehdri.e_ident));
|
memcpy(&h3.ehdr.e_ident[0], &ehdri.e_ident[0], sizeof(ehdri.e_ident));
|
||||||
set_te32(&h3.ehdr.e_flags, e_flags);
|
set_te32(&h3.ehdr.e_flags, e_flags);
|
||||||
generateElfHdr(fo, &h3, getbrk(phdri, e_phnum) );
|
generateElfHdr(fo, &h3, getbrk(phdri, e_phnum) );
|
||||||
}
|
}
|
||||||
@@ -2236,7 +2236,7 @@ void PackLinuxElf64::pack1(OutputFile *fo, Filter & /*ft*/)
|
|||||||
//set the shstrtab
|
//set the shstrtab
|
||||||
sec_strndx = &shdri[ehdri.e_shstrndx];
|
sec_strndx = &shdri[ehdri.e_shstrndx];
|
||||||
|
|
||||||
char *strtab = new char[sec_strndx->sh_size];
|
char *strtab = new char[(unsigned) sec_strndx->sh_size];
|
||||||
fi->seek(0,SEEK_SET);
|
fi->seek(0,SEEK_SET);
|
||||||
fi->seek(sec_strndx->sh_offset,SEEK_SET);
|
fi->seek(sec_strndx->sh_offset,SEEK_SET);
|
||||||
fi->readx(strtab,sec_strndx->sh_size);
|
fi->readx(strtab,sec_strndx->sh_size);
|
||||||
@@ -2245,7 +2245,7 @@ void PackLinuxElf64::pack1(OutputFile *fo, Filter & /*ft*/)
|
|||||||
|
|
||||||
Elf64_Shdr const *buildid = elf_find_section_name(".note.gnu.build-id");
|
Elf64_Shdr const *buildid = elf_find_section_name(".note.gnu.build-id");
|
||||||
if (buildid) {
|
if (buildid) {
|
||||||
unsigned char *data = new unsigned char[buildid->sh_size];
|
unsigned char *data = new unsigned char[(unsigned) buildid->sh_size];
|
||||||
memset(data,0,buildid->sh_size);
|
memset(data,0,buildid->sh_size);
|
||||||
fi->seek(0,SEEK_SET);
|
fi->seek(0,SEEK_SET);
|
||||||
fi->seek(buildid->sh_offset,SEEK_SET);
|
fi->seek(buildid->sh_offset,SEEK_SET);
|
||||||
@@ -2254,7 +2254,7 @@ void PackLinuxElf64::pack1(OutputFile *fo, Filter & /*ft*/)
|
|||||||
buildid_data = data;
|
buildid_data = data;
|
||||||
|
|
||||||
o_elf_shnum = 3;
|
o_elf_shnum = 3;
|
||||||
memset(&shdrout.shdr,0,sizeof(shdrout));
|
memset(&shdrout,0,sizeof(shdrout));
|
||||||
|
|
||||||
//setup the build-id
|
//setup the build-id
|
||||||
memcpy(&shdrout.shdr[1],buildid, sizeof(shdrout.shdr[1]));
|
memcpy(&shdrout.shdr[1],buildid, sizeof(shdrout.shdr[1]));
|
||||||
|
|||||||
+2
-2
@@ -466,12 +466,12 @@ PackMachBase<T>::compare_segment_command(void const *const aa, void const *const
|
|||||||
#undef PAGE_MASK
|
#undef PAGE_MASK
|
||||||
#undef PAGE_SIZE
|
#undef PAGE_SIZE
|
||||||
#define PAGE_MASK (~0u<<12)
|
#define PAGE_MASK (~0u<<12)
|
||||||
#define PAGE_SIZE -PAGE_MASK
|
#define PAGE_SIZE (0u-PAGE_MASK)
|
||||||
|
|
||||||
#undef PAGE_MASK64
|
#undef PAGE_MASK64
|
||||||
#undef PAGE_SIZE64
|
#undef PAGE_SIZE64
|
||||||
#define PAGE_MASK64 (~(acc_uint64l_t)0<<12)
|
#define PAGE_MASK64 (~(acc_uint64l_t)0<<12)
|
||||||
#define PAGE_SIZE64 -PAGE_MASK64
|
#define PAGE_SIZE64 ((acc_uint64l_t)0-PAGE_MASK64)
|
||||||
|
|
||||||
// At 2013-02-03 part of the source for codesign was
|
// At 2013-02-03 part of the source for codesign was
|
||||||
// http://opensource.apple.com/source/cctools/cctools-836/libstuff/ofile.c
|
// http://opensource.apple.com/source/cctools/cctools-836/libstuff/ofile.c
|
||||||
|
|||||||
+6
-7
@@ -508,22 +508,21 @@ int PackUnix::canUnpack()
|
|||||||
int bufsize = 2*4096 + 2*small +1;
|
int bufsize = 2*4096 + 2*small +1;
|
||||||
if (bufsize > fi->st_size())
|
if (bufsize > fi->st_size())
|
||||||
bufsize = fi->st_size();
|
bufsize = fi->st_size();
|
||||||
upx_byte buf[bufsize];
|
MemBuffer buf(bufsize);
|
||||||
|
|
||||||
fi->seek(-bufsize, SEEK_END);
|
fi->seek(-bufsize, SEEK_END);
|
||||||
fi->readx(buf, bufsize);
|
fi->readx(buf, bufsize);
|
||||||
buf[small] = 1; // Prevent running off the low-address end.
|
int i = bufsize;
|
||||||
upx_byte *ptr = &buf[bufsize];
|
while (i > small && 0 == buf[--i]) { }
|
||||||
while (0 == *--ptr) ;
|
i -= small;
|
||||||
ptr -= small;
|
|
||||||
// allow incompressible extents
|
// allow incompressible extents
|
||||||
if (!getPackHeader(ptr, bufsize - (ptr - buf), true))
|
if (i < 0 || !getPackHeader(buf + i, bufsize - i, true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int l = ph.buf_offset + ph.getPackHeaderSize();
|
int l = ph.buf_offset + ph.getPackHeaderSize();
|
||||||
if (l < 0 || l + 4 > bufsize)
|
if (l < 0 || l + 4 > bufsize)
|
||||||
throwCantUnpack("file corrupted");
|
throwCantUnpack("file corrupted");
|
||||||
overlay_offset = get_te32(ptr+l);
|
overlay_offset = get_te32(buf + i + l);
|
||||||
if ((off_t)overlay_offset >= file_size)
|
if ((off_t)overlay_offset >= file_size)
|
||||||
throwCantUnpack("file corrupted");
|
throwCantUnpack("file corrupted");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user