prevent warning C4319: '~': zero extending 'const unsigned int' to 'upx_uint64_t' of greater size
modified: linker.cpp modified: p_lx_elf.cpp modified: pefile.cpp
This commit is contained in:
parent
3df7d26101
commit
134b829d59
@ -435,8 +435,10 @@ int ElfLinker::addLoader(const char *sname)
|
||||
if (section->p2align) {
|
||||
assert(tail);
|
||||
assert(tail != section);
|
||||
// .p2align must be < 32
|
||||
unsigned const v = ~0u << section->p2align;
|
||||
if (unsigned const l = ~v & (0u-(tail->offset + tail->size))) {
|
||||
if (unsigned const l = ~v & (0u-(unsigned)(tail->offset + tail->size))) {
|
||||
|
||||
alignCode(l);
|
||||
tail->size += l;
|
||||
}
|
||||
|
||||
@ -1438,7 +1438,7 @@ bool PackLinuxElf32::canPack()
|
||||
exetype = 1;
|
||||
load_va = get_te32(&phdr->p_vaddr);
|
||||
unsigned file_offset = get_te32(&phdr->p_offset);
|
||||
if (~page_mask & file_offset) {
|
||||
if (~(upx_uint64_t)page_mask & file_offset) {
|
||||
if ((~page_mask & (unsigned)load_va) == file_offset) {
|
||||
throwCantPack("Go-language PT_LOAD: try hemfix.c, or try '--force-execve'");
|
||||
// Fixing it inside upx fails because packExtent() reads original file.
|
||||
|
||||
@ -2414,7 +2414,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh,
|
||||
osection[1].vsize = (osection[1].size + oam1) &~ oam1;
|
||||
osection[2].vsize = (osection[2].size + ncsize_virt_increase + oam1) &~ oam1;
|
||||
oh.imagesize = osection[2].vaddr + osection[2].vsize;
|
||||
osection[0].rawdataptr = (pe_offset + sizeof(ht) + sizeof_osection + fam1) &~ fam1;
|
||||
osection[0].rawdataptr = (pe_offset + sizeof(ht) + sizeof_osection + fam1) &~ (size_t)fam1;
|
||||
osection[1].rawdataptr = osection[0].rawdataptr;
|
||||
}
|
||||
else
|
||||
@ -2422,7 +2422,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh,
|
||||
osection[1].vsize = osection[1].size;
|
||||
osection[2].vsize = osection[2].size;
|
||||
osection[0].rawdataptr = 0;
|
||||
osection[1].rawdataptr = (pe_offset + sizeof(ht) + sizeof_osection + fam1) &~ fam1;
|
||||
osection[1].rawdataptr = (pe_offset + sizeof(ht) + sizeof_osection + fam1) &~ (size_t)fam1;
|
||||
}
|
||||
osection[2].rawdataptr = osection[1].rawdataptr + osection[1].size;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user