fix editing rot for mach-o .dylib
https://github.com/upx/upx/issues/57 modified: p_mach.cpp
This commit is contained in:
parent
4854c03096
commit
ee3f1292d0
@ -1366,7 +1366,6 @@ void PackMachBase<T>::pack1(OutputFile *const fo, Filter &/*ft*/) // generate e
|
|||||||
unsigned const sz_threado = threado_size();
|
unsigned const sz_threado = threado_size();
|
||||||
MemBuffer space(sz_threado); memset(space, 0, sz_threado);
|
MemBuffer space(sz_threado); memset(space, 0, sz_threado);
|
||||||
fo->write(space, sz_threado);
|
fo->write(space, sz_threado);
|
||||||
sz_mach_headers = fo->getBytesWritten();
|
|
||||||
}
|
}
|
||||||
else if (my_filetype == Mach_header::MH_DYLIB) {
|
else if (my_filetype == Mach_header::MH_DYLIB) {
|
||||||
Mach_command const *ptr = (Mach_command const *)rawmseg;
|
Mach_command const *ptr = (Mach_command const *)rawmseg;
|
||||||
@ -1398,13 +1397,10 @@ void PackMachBase<T>::pack1(OutputFile *const fo, Filter &/*ft*/) // generate e
|
|||||||
}
|
}
|
||||||
memset(&linkitem, 0, sizeof(linkitem));
|
memset(&linkitem, 0, sizeof(linkitem));
|
||||||
fo->write(&linkitem, sizeof(linkitem));
|
fo->write(&linkitem, sizeof(linkitem));
|
||||||
fo->write(rawmseg, mhdri.sizeofcmds);
|
|
||||||
|
|
||||||
gap = secTEXT.offset - sz_mach_headers;
|
|
||||||
}
|
}
|
||||||
sz_mach_headers = fo->getBytesWritten();
|
sz_mach_headers = fo->getBytesWritten();
|
||||||
MemBuffer filler(gap);
|
gap = secTEXT.offset - sz_mach_headers;
|
||||||
memset(filler, 0, gap);
|
MemBuffer filler(gap); filler.clear();
|
||||||
fo->write(filler, gap);
|
fo->write(filler, gap);
|
||||||
sz_mach_headers += gap;
|
sz_mach_headers += gap;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user