mirror of
https://github.com/upx/upx
synced 2025-10-05 19:20:23 +08:00
Silence some bogus coverity warnings.
This commit is contained in:
parent
2a6bbcaf8f
commit
0ccbc5f139
|
@ -339,9 +339,9 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
||||||
};
|
};
|
||||||
PROPVARIANT pr[8];
|
PROPVARIANT pr[8];
|
||||||
const unsigned nprops = 8;
|
const unsigned nprops = 8;
|
||||||
static wchar_t matchfinder[] = L"BT4";
|
static const wchar_t matchfinder[] = L"BT4";
|
||||||
assert(NCompress::NLZMA::FindMatchFinder(matchfinder) >= 0);
|
assert(NCompress::NLZMA::FindMatchFinder(matchfinder) >= 0);
|
||||||
pr[7].vt = VT_BSTR; pr[7].bstrVal = matchfinder;
|
pr[7].vt = VT_BSTR; pr[7].bstrVal = ACC_PCAST(BSTR, ACC_UNCONST_CAST(wchar_t *, matchfinder));
|
||||||
pr[0].vt = pr[1].vt = pr[2].vt = pr[3].vt = VT_UI4;
|
pr[0].vt = pr[1].vt = pr[2].vt = pr[3].vt = VT_UI4;
|
||||||
pr[4].vt = pr[5].vt = pr[6].vt = VT_UI4;
|
pr[4].vt = pr[5].vt = pr[6].vt = VT_UI4;
|
||||||
if (prepare(res, src_len, method, level, lcconf) != 0)
|
if (prepare(res, src_len, method, level, lcconf) != 0)
|
||||||
|
|
|
@ -140,8 +140,8 @@ static void show_all_packers(FILE *f, int verbose)
|
||||||
{
|
{
|
||||||
options_t o; o.reset();
|
options_t o; o.reset();
|
||||||
PackerNames pn; pn.o = &o;
|
PackerNames pn; pn.o = &o;
|
||||||
PackMaster::visitAllPackers(pn.visit, NULL, &o, &pn);
|
PackMaster::visitAllPackers(PackerNames::visit, NULL, &o, &pn);
|
||||||
qsort(pn.names, pn.names_count, sizeof(PackerNames::Entry), pn.cmp_fname);
|
qsort(pn.names, pn.names_count, sizeof(PackerNames::Entry), PackerNames::cmp_fname);
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
for (size_t i = 0; i < pn.names_count; ++i)
|
for (size_t i = 0; i < pn.names_count; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -338,6 +338,7 @@ void LeFile::countFixups(unsigned *counts) const
|
||||||
break;
|
break;
|
||||||
case 6: // 16:32 pointer
|
case 6: // 16:32 pointer
|
||||||
counts[o] += 9;
|
counts[o] += 9;
|
||||||
|
// fall through
|
||||||
case 7: // 32-bit offset
|
case 7: // 32-bit offset
|
||||||
counts[fix[4]-1] += 4;
|
counts[fix[4]-1] += 4;
|
||||||
fix += (fix[1] & 0x10) ? 9 : 7;
|
fix += (fix[1] & 0x10) ? 9 : 7;
|
||||||
|
|
|
@ -3582,7 +3582,7 @@ Linker* PackLinuxElf32armBe::newLinker() const
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
PackLinuxElf32::elf_get_offset_from_address(unsigned const addr) const
|
PackLinuxElf32::elf_get_offset_from_address(unsigned addr) const
|
||||||
{
|
{
|
||||||
Elf32_Phdr const *phdr = phdri;
|
Elf32_Phdr const *phdr = phdri;
|
||||||
int j = e_phnum;
|
int j = e_phnum;
|
||||||
|
@ -3596,7 +3596,7 @@ PackLinuxElf32::elf_get_offset_from_address(unsigned const addr) const
|
||||||
}
|
}
|
||||||
|
|
||||||
Elf32_Dyn const *
|
Elf32_Dyn const *
|
||||||
PackLinuxElf32::elf_has_dynamic(unsigned int const key) const
|
PackLinuxElf32::elf_has_dynamic(unsigned int key) const
|
||||||
{
|
{
|
||||||
Elf32_Dyn const *dynp= dynseg;
|
Elf32_Dyn const *dynp= dynseg;
|
||||||
if (dynp)
|
if (dynp)
|
||||||
|
@ -3607,7 +3607,7 @@ PackLinuxElf32::elf_has_dynamic(unsigned int const key) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void const *
|
void const *
|
||||||
PackLinuxElf32::elf_find_dynamic(unsigned int const key) const
|
PackLinuxElf32::elf_find_dynamic(unsigned int key) const
|
||||||
{
|
{
|
||||||
Elf32_Dyn const *dynp= dynseg;
|
Elf32_Dyn const *dynp= dynseg;
|
||||||
if (dynp)
|
if (dynp)
|
||||||
|
@ -3622,7 +3622,7 @@ PackLinuxElf32::elf_find_dynamic(unsigned int const key) const
|
||||||
}
|
}
|
||||||
|
|
||||||
upx_uint64_t
|
upx_uint64_t
|
||||||
PackLinuxElf32::elf_unsigned_dynamic(unsigned int const key) const
|
PackLinuxElf32::elf_unsigned_dynamic(unsigned int key) const
|
||||||
{
|
{
|
||||||
Elf32_Dyn const *dynp= dynseg;
|
Elf32_Dyn const *dynp= dynseg;
|
||||||
if (dynp)
|
if (dynp)
|
||||||
|
@ -3633,7 +3633,7 @@ PackLinuxElf32::elf_unsigned_dynamic(unsigned int const key) const
|
||||||
}
|
}
|
||||||
|
|
||||||
upx_uint64_t
|
upx_uint64_t
|
||||||
PackLinuxElf64::elf_get_offset_from_address(upx_uint64_t const addr) const
|
PackLinuxElf64::elf_get_offset_from_address(upx_uint64_t addr) const
|
||||||
{
|
{
|
||||||
Elf64_Phdr const *phdr = phdri;
|
Elf64_Phdr const *phdr = phdri;
|
||||||
int j = e_phnum;
|
int j = e_phnum;
|
||||||
|
@ -3647,7 +3647,7 @@ PackLinuxElf64::elf_get_offset_from_address(upx_uint64_t const addr) const
|
||||||
}
|
}
|
||||||
|
|
||||||
Elf64_Dyn const *
|
Elf64_Dyn const *
|
||||||
PackLinuxElf64::elf_has_dynamic(unsigned int const key) const
|
PackLinuxElf64::elf_has_dynamic(unsigned int key) const
|
||||||
{
|
{
|
||||||
Elf64_Dyn const *dynp= dynseg;
|
Elf64_Dyn const *dynp= dynseg;
|
||||||
if (dynp)
|
if (dynp)
|
||||||
|
@ -3658,7 +3658,7 @@ PackLinuxElf64::elf_has_dynamic(unsigned int const key) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void const *
|
void const *
|
||||||
PackLinuxElf64::elf_find_dynamic(unsigned int const key) const
|
PackLinuxElf64::elf_find_dynamic(unsigned int key) const
|
||||||
{
|
{
|
||||||
Elf64_Dyn const *dynp= dynseg;
|
Elf64_Dyn const *dynp= dynseg;
|
||||||
if (dynp)
|
if (dynp)
|
||||||
|
@ -3673,7 +3673,7 @@ PackLinuxElf64::elf_find_dynamic(unsigned int const key) const
|
||||||
}
|
}
|
||||||
|
|
||||||
upx_uint64_t
|
upx_uint64_t
|
||||||
PackLinuxElf64::elf_unsigned_dynamic(unsigned int const key) const
|
PackLinuxElf64::elf_unsigned_dynamic(unsigned int key) const
|
||||||
{
|
{
|
||||||
Elf64_Dyn const *dynp= dynseg;
|
Elf64_Dyn const *dynp= dynseg;
|
||||||
if (dynp)
|
if (dynp)
|
||||||
|
|
|
@ -147,7 +147,7 @@ protected:
|
||||||
Elf32_Shdr const *elf_find_section_type(unsigned) const;
|
Elf32_Shdr const *elf_find_section_type(unsigned) const;
|
||||||
void const *elf_find_dynamic(unsigned) const;
|
void const *elf_find_dynamic(unsigned) const;
|
||||||
Elf32_Dyn const *elf_has_dynamic(unsigned) const;
|
Elf32_Dyn const *elf_has_dynamic(unsigned) const;
|
||||||
upx_uint64_t elf_unsigned_dynamic(unsigned) const;
|
virtual upx_uint64_t elf_unsigned_dynamic(unsigned) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Elf32_Ehdr ehdri; // from input file
|
Elf32_Ehdr ehdri; // from input file
|
||||||
|
@ -264,7 +264,7 @@ protected:
|
||||||
Elf64_Shdr const *elf_find_section_type(unsigned) const;
|
Elf64_Shdr const *elf_find_section_type(unsigned) const;
|
||||||
void const *elf_find_dynamic(unsigned) const;
|
void const *elf_find_dynamic(unsigned) const;
|
||||||
Elf64_Dyn const *elf_has_dynamic(unsigned) const;
|
Elf64_Dyn const *elf_has_dynamic(unsigned) const;
|
||||||
upx_uint64_t elf_unsigned_dynamic(unsigned) const;
|
virtual upx_uint64_t elf_unsigned_dynamic(unsigned) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Elf64_Ehdr ehdri; // from input file
|
Elf64_Ehdr ehdri; // from input file
|
||||||
|
|
|
@ -709,7 +709,7 @@ void PackPs1::unpack(OutputFile *fo)
|
||||||
{
|
{
|
||||||
// restore orig exec hdr
|
// restore orig exec hdr
|
||||||
memcpy(&oh, &ih, sizeof(ih));
|
memcpy(&oh, &ih, sizeof(ih));
|
||||||
memcpy(&oh.epc, &bh, SZ_IH_BKUP);
|
memcpy((void *) &oh.epc, &bh, SZ_IH_BKUP);
|
||||||
|
|
||||||
// check for removed sector alignment
|
// check for removed sector alignment
|
||||||
assert(oh.tx_len >= ph.u_len);
|
assert(oh.tx_len >= ph.u_len);
|
||||||
|
|
|
@ -957,8 +957,8 @@ static const
|
||||||
#include "stub/powerpc-linux.kernel.vmlinux-head.h"
|
#include "stub/powerpc-linux.kernel.vmlinux-head.h"
|
||||||
|
|
||||||
unsigned PackVmlinuxI386::write_vmlinux_head(
|
unsigned PackVmlinuxI386::write_vmlinux_head(
|
||||||
OutputFile *const fo,
|
OutputFile *fo,
|
||||||
Shdr *const stxt
|
Shdr *stxt
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// COMPRESSED_LENGTH
|
// COMPRESSED_LENGTH
|
||||||
|
@ -972,8 +972,8 @@ unsigned PackVmlinuxI386::write_vmlinux_head(
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned PackVmlinuxAMD64::write_vmlinux_head(
|
unsigned PackVmlinuxAMD64::write_vmlinux_head(
|
||||||
OutputFile *const fo,
|
OutputFile *fo,
|
||||||
Shdr *const stxt
|
Shdr *stxt
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// COMPRESSED_LENGTH
|
// COMPRESSED_LENGTH
|
||||||
|
@ -1038,8 +1038,8 @@ void PackVmlinuxAMD64::defineDecompressorSymbols()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned PackVmlinuxARMEL::write_vmlinux_head(
|
unsigned PackVmlinuxARMEL::write_vmlinux_head(
|
||||||
OutputFile *const fo,
|
OutputFile *fo,
|
||||||
Shdr *const stxt
|
Shdr *stxt
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// First word from vmlinux-head.S
|
// First word from vmlinux-head.S
|
||||||
|
@ -1060,8 +1060,8 @@ unsigned PackVmlinuxARMEL::write_vmlinux_head(
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned PackVmlinuxARMEB::write_vmlinux_head(
|
unsigned PackVmlinuxARMEB::write_vmlinux_head(
|
||||||
OutputFile *const fo,
|
OutputFile *fo,
|
||||||
Shdr *const stxt
|
Shdr *stxt
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// First word from vmlinux-head.S
|
// First word from vmlinux-head.S
|
||||||
|
@ -1082,8 +1082,8 @@ unsigned PackVmlinuxARMEB::write_vmlinux_head(
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned PackVmlinuxPPC32::write_vmlinux_head(
|
unsigned PackVmlinuxPPC32::write_vmlinux_head(
|
||||||
OutputFile * /*const fo*/,
|
OutputFile * /*fo*/,
|
||||||
Shdr * /*const stxt*/
|
Shdr * /*stxt*/
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -87,8 +87,8 @@ protected:
|
||||||
virtual int canUnpack(); // bool, except -1: format known, but not packed
|
virtual int canUnpack(); // bool, except -1: format known, but not packed
|
||||||
virtual void unpack(OutputFile *fo);
|
virtual void unpack(OutputFile *fo);
|
||||||
virtual unsigned write_vmlinux_head(
|
virtual unsigned write_vmlinux_head(
|
||||||
OutputFile *const fo,
|
OutputFile *fo,
|
||||||
Shdr *const stxt
|
Shdr *stxt
|
||||||
) = 0;
|
) = 0;
|
||||||
static int __acc_cdecl_qsort compare_Phdr(void const *aa, void const *bb);
|
static int __acc_cdecl_qsort compare_Phdr(void const *aa, void const *bb);
|
||||||
};
|
};
|
||||||
|
@ -113,8 +113,8 @@ protected:
|
||||||
virtual bool is_valid_e_entry(Addr);
|
virtual bool is_valid_e_entry(Addr);
|
||||||
virtual bool has_valid_vmlinux_head();
|
virtual bool has_valid_vmlinux_head();
|
||||||
virtual unsigned write_vmlinux_head(
|
virtual unsigned write_vmlinux_head(
|
||||||
OutputFile *const fo,
|
OutputFile *fo,
|
||||||
Shdr *const stxt
|
Shdr *stxt
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -138,8 +138,8 @@ protected:
|
||||||
virtual bool is_valid_e_entry(Addr);
|
virtual bool is_valid_e_entry(Addr);
|
||||||
virtual bool has_valid_vmlinux_head();
|
virtual bool has_valid_vmlinux_head();
|
||||||
virtual unsigned write_vmlinux_head(
|
virtual unsigned write_vmlinux_head(
|
||||||
OutputFile *const fo,
|
OutputFile *fo,
|
||||||
Shdr *const stxt
|
Shdr *stxt
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -162,8 +162,8 @@ protected:
|
||||||
virtual bool is_valid_e_entry(Addr);
|
virtual bool is_valid_e_entry(Addr);
|
||||||
virtual bool has_valid_vmlinux_head();
|
virtual bool has_valid_vmlinux_head();
|
||||||
virtual unsigned write_vmlinux_head(
|
virtual unsigned write_vmlinux_head(
|
||||||
OutputFile *const fo,
|
OutputFile *fo,
|
||||||
Shdr *const stxt
|
Shdr *stxt
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -186,8 +186,8 @@ protected:
|
||||||
virtual bool is_valid_e_entry(Addr);
|
virtual bool is_valid_e_entry(Addr);
|
||||||
virtual bool has_valid_vmlinux_head();
|
virtual bool has_valid_vmlinux_head();
|
||||||
virtual unsigned write_vmlinux_head(
|
virtual unsigned write_vmlinux_head(
|
||||||
OutputFile *const fo,
|
OutputFile *fo,
|
||||||
Shdr *const stxt
|
Shdr *stxt
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -210,8 +210,8 @@ protected:
|
||||||
virtual bool is_valid_e_entry(Addr);
|
virtual bool is_valid_e_entry(Addr);
|
||||||
virtual bool has_valid_vmlinux_head();
|
virtual bool has_valid_vmlinux_head();
|
||||||
virtual unsigned write_vmlinux_head(
|
virtual unsigned write_vmlinux_head(
|
||||||
OutputFile *const fo,
|
OutputFile *fo,
|
||||||
Shdr *const stxt
|
Shdr *stxt
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -235,8 +235,8 @@ protected:
|
||||||
virtual bool is_valid_e_entry(Addr);
|
virtual bool is_valid_e_entry(Addr);
|
||||||
virtual bool has_valid_vmlinux_head();
|
virtual bool has_valid_vmlinux_head();
|
||||||
virtual unsigned write_vmlinux_head(
|
virtual unsigned write_vmlinux_head(
|
||||||
OutputFile *const fo,
|
OutputFile *fo,
|
||||||
Shdr *const stxt
|
Shdr *stxt
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -964,7 +964,7 @@ void PackVmlinuzARMEL::defineDecompressorSymbols()
|
||||||
linker->defineSymbol("METHOD", ph.method);
|
linker->defineSymbol("METHOD", ph.method);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned PackVmlinuzARMEL::write_vmlinuz_head(OutputFile *const fo)
|
unsigned PackVmlinuzARMEL::write_vmlinuz_head(OutputFile *fo)
|
||||||
{ // First word from vmlinuz-head.S
|
{ // First word from vmlinuz-head.S
|
||||||
fo->write(&stub_arm_v5a_linux_kernel_vmlinuz_head[0], 4);
|
fo->write(&stub_arm_v5a_linux_kernel_vmlinuz_head[0], 4);
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ protected:
|
||||||
virtual void readKernel();
|
virtual void readKernel();
|
||||||
|
|
||||||
virtual void buildLoader(const Filter *ft);
|
virtual void buildLoader(const Filter *ft);
|
||||||
virtual unsigned write_vmlinuz_head(OutputFile *const fo);
|
virtual unsigned write_vmlinuz_head(OutputFile *fo);
|
||||||
virtual void defineDecompressorSymbols();
|
virtual void defineDecompressorSymbols();
|
||||||
virtual Linker* newLinker() const;
|
virtual Linker* newLinker() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user