Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to load mach-o correctly may lead to segment fault #26

Open
4B5F5F4B opened this issue Jun 15, 2021 · 0 comments
Open

Failing to load mach-o correctly may lead to segment fault #26

4B5F5F4B opened this issue Jun 15, 2021 · 0 comments

Comments

@4B5F5F4B
Copy link

Hi all,

While trying your tool I came across some segment fault like the issue posted here.

#25

I spent some time to debug the root cause of mentioned bug, I find dsdump doesn't load mach-o into memory correctly. The author naively mapped mach-o file into memory through mmap(. You can find the following code in XRMachOLibrary.mm

void* buff = ::mmap((void*)0x0000000400000000UL, fsize, PROT_READ, MAP_PRIVATE, self.fd, 0);
payload::data = (uint8_t *)buff; // self.data;
payload::size = fsize;

In fact you'd better parse all segments carefully.

@4B5F5F4B 4B5F5F4B changed the title Fail to load mach-o correctly may lead to segment fault Failing to load mach-o correctly may lead to segment fault Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant