diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index e06ac121..c17c672d 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -42,6 +42,9 @@ #include "p_lx_elf.h" #include "ui.h" +typedef upx_uint32_t u32_t; // easier to type; more narrow +typedef upx_uint64_t u64_t; // easier to type; more narrow + #define PT_LOAD32 Elf32_Phdr::PT_LOAD #define PT_LOAD64 Elf64_Phdr::PT_LOAD #define PT_NOTE32 Elf32_Phdr::PT_NOTE @@ -4952,7 +4955,7 @@ PackLinuxElf32::elf_find_dynamic(unsigned int key) const for (; (unsigned)((char const *)dynp - (char const *)dynseg) < sz_dynseg && Elf32_Dyn::DT_NULL!=dynp->d_tag; ++dynp) if (get_te32(&dynp->d_tag)==key) { unsigned const t= elf_get_offset_from_address(get_te32(&dynp->d_val)); - if (t && t < file_size) { + if (t && t < (unsigned)file_size) { return t + file_image; } break; diff --git a/src/p_lx_elf.h b/src/p_lx_elf.h index 930851ee..21127f24 100644 --- a/src/p_lx_elf.h +++ b/src/p_lx_elf.h @@ -33,9 +33,6 @@ #ifndef __UPX_P_LX_ELF_H //{ #define __UPX_P_LX_ELF_H 1 -typedef upx_uint32_t u32_t; // easier to type; more narrow -typedef upx_uint64_t u64_t; // easier to type; more narrow - class PackLinuxElf : public PackUnix { typedef PackUnix super; diff --git a/src/p_mach.cpp b/src/p_mach.cpp index 8c1cbbd3..91e7ea9a 100644 --- a/src/p_mach.cpp +++ b/src/p_mach.cpp @@ -1542,8 +1542,8 @@ int PackMachBase::canUnpack() ptr = (Mach_command const *)(ptr->cmdsize + (char const *)ptr), ++j) { if ((unsigned)headway < ptr->cmdsize) { infoWarning("bad Mach_command[%u]{@0x%lx,+0x%x}: file_size=0x%lx cmdsize=0x%lx", - j, sizeof(mhdri) + ((char const *)ptr - (char const *)rawmseg), headway, - file_size, (unsigned long)ptr->cmdsize); + j, (unsigned long) (sizeof(mhdri) + ((char const *)ptr - (char const *)rawmseg)), headway, + (unsigned long) file_size, (unsigned long)ptr->cmdsize); throwCantUnpack("file corrupted"); } if (lc_seg == ptr->cmd) { @@ -1553,8 +1553,8 @@ int PackMachBase::canUnpack() || (unsigned long)file_size < (segptr->filesize + segptr->fileoff)) { infoWarning("bad Mach_segment_command[%u]{@0x%lx,+0x%x}: file_size=0x%lx cmdsize=0x%lx" " filesize=0x%lx fileoff=0x%lx", - j, sizeof(mhdri) + ((char const *)ptr - (char const *)rawmseg), headway, - file_size, (unsigned long)ptr->cmdsize, + j, (unsigned long) (sizeof(mhdri) + ((char const *)ptr - (char const *)rawmseg)), headway, + (unsigned long) file_size, (unsigned long)ptr->cmdsize, (unsigned long)segptr->filesize, (unsigned long)segptr->fileoff); throwCantUnpack("file corrupted"); }