From 50c3b5df3204a465338fcb2b000c4bd08b0b7335 Mon Sep 17 00:00:00 2001 From: Jude Taylor Date: Wed, 17 Aug 2016 10:24:11 -0700 Subject: iterate through fat_headers correctly --- src/resolve-system-dependencies/resolve-system-dependencies.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resolve-system-dependencies/resolve-system-dependencies.cc b/src/resolve-system-dependencies/resolve-system-dependencies.cc index 8502444ba0b2..a5f0cd7b3b70 100644 --- a/src/resolve-system-dependencies/resolve-system-dependencies.cc +++ b/src/resolve-system-dependencies/resolve-system-dependencies.cc @@ -54,7 +54,7 @@ std::set runResolver(const Path & filename) { uint32_t narches = DO_SWAP(should_swap, ((struct fat_header*)obj)->nfat_arch); 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; if(DO_SWAP(should_swap, arch->cputype) == CPU_TYPE_X86_64) { mach64_offset = (ptrdiff_t)DO_SWAP(should_swap, arch->offset); -- cgit 1.4.1