iterate through fat_headers correctly
This commit is contained in:
parent
ca0bce2851
commit
50c3b5df32
|
@ -54,7 +54,7 @@ std::set<std::string> runResolver(const Path & filename) {
|
||||||
uint32_t narches = DO_SWAP(should_swap, ((struct fat_header*)obj)->nfat_arch);
|
uint32_t narches = DO_SWAP(should_swap, ((struct fat_header*)obj)->nfat_arch);
|
||||||
|
|
||||||
for(uint32_t iter = 0; iter < narches; iter++) {
|
for(uint32_t iter = 0; iter < narches; iter++) {
|
||||||
ptrdiff_t header_offset = (ptrdiff_t)obj + sizeof(struct fat_header);
|
ptrdiff_t header_offset = (ptrdiff_t)obj + sizeof(struct fat_header) * (iter + 1);
|
||||||
struct fat_arch* arch = (struct fat_arch*)header_offset;
|
struct fat_arch* arch = (struct fat_arch*)header_offset;
|
||||||
if(DO_SWAP(should_swap, arch->cputype) == CPU_TYPE_X86_64) {
|
if(DO_SWAP(should_swap, arch->cputype) == CPU_TYPE_X86_64) {
|
||||||
mach64_offset = (ptrdiff_t)DO_SWAP(should_swap, arch->offset);
|
mach64_offset = (ptrdiff_t)DO_SWAP(should_swap, arch->offset);
|
||||||
|
|
Loading…
Reference in a new issue