mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
0==.vmsize in Go-language LC_SEGMENT_64; also g++ 5.1.1 nit
This commit is contained in:
parent
ac1ccaa246
commit
163e1907a4
|
@ -1270,7 +1270,7 @@ void PackMachBase<T>::unpack(OutputFile *fo)
|
||||||
throwCantUnpack("file header corrupted");
|
throwCantUnpack("file header corrupted");
|
||||||
}
|
}
|
||||||
unsigned const sz_cmds = mhdri.sizeofcmds;
|
unsigned const sz_cmds = mhdri.sizeofcmds;
|
||||||
if ((sizeof(mhdri) + sz_cmds) > fi->st_size()) {
|
if ((sizeof(mhdri) + sz_cmds) > (size_t)fi->st_size()) {
|
||||||
throwCantUnpack("file header corrupted");
|
throwCantUnpack("file header corrupted");
|
||||||
}
|
}
|
||||||
rawmseg = (Mach_segment_command *)new char[sz_cmds];
|
rawmseg = (Mach_segment_command *)new char[sz_cmds];
|
||||||
|
@ -1425,11 +1425,11 @@ bool PackMachBase<T>::canPack()
|
||||||
// Check alignment of non-null LC_SEGMENT.
|
// Check alignment of non-null LC_SEGMENT.
|
||||||
for (unsigned j= 0; j < ncmds; ++j) {
|
for (unsigned j= 0; j < ncmds; ++j) {
|
||||||
if (lc_seg==msegcmd[j].cmd) {
|
if (lc_seg==msegcmd[j].cmd) {
|
||||||
|
if (msegcmd[j].vmsize==0)
|
||||||
|
break; // was sorted last
|
||||||
if (~PAGE_MASK & (msegcmd[j].fileoff | msegcmd[j].vmaddr)) {
|
if (~PAGE_MASK & (msegcmd[j].fileoff | msegcmd[j].vmaddr)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (msegcmd[j].vmsize==0)
|
|
||||||
break; // was sorted last
|
|
||||||
|
|
||||||
// We used to check that LC_SEGMENTS were contiguous,
|
// We used to check that LC_SEGMENTS were contiguous,
|
||||||
// but apparently that is not needed anymore,
|
// but apparently that is not needed anymore,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user