iterate through fat_headers correctly
This commit is contained in:
		
							parent
							
								
									ca0bce2851
								
							
						
					
					
						commit
						50c3b5df32
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
					@ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue