facebook / fishhook

A library that enables dynamically rebinding symbols in Mach-O binaries running on iOS.
BSD 3-Clause "New" or "Revised" License
5.17k stars 965 forks source link

Thread 1: EXC_BAD_ACCESS #70

Closed meiszhe closed 4 years ago

meiszhe commented 4 years ago

*(cur->rebindings[j].replaced) = indirect_symbol_bindings[i]; FishHook will crash in this function cwsa_perform_rebinding_with_section. Do someone know solution of this issue, please tell me , thank you.

swolchok commented 4 years ago

Have you updated your local checkout of fishhook recently? It's difficult to tell without the full crash report, but https://github.com/facebook/fishhook/commit/4eeb18c87970c41be6a26429f24ee7f4b5105f61 fixed an issue that fits the description you provided.

meiszhe commented 4 years ago

Have you updated your local checkout of fishhook recently? It's difficult to tell without the full crash report, but 4eeb18c fixed an issue that fits the description you provided.

Hello, i updated my local checkout, but the crash occured again. if (cur->rebindings[j].replaced != NULL && indirect_symbol_bindings[i] != cur->rebindings[j].replacement) { *(cur->rebindings[j].replaced) = indirect_symbol_bindings[i]; } Crash Info : Thread 1: EXC_BAD_ACCESS (code=2, address=0x106ea8c90) I use fishhook (I add 'cwsa' prefix ): const struct mach_header *header = _dyld_get_image_header(index); intptr_t slide = _dyld_get_image_vmaddr_slide(index); cwsa_rebind_symbols_image(header, slide, (struct cwsa_rebinding[1]){ {"objc_msgSend", cwsa_hook_objc_msgSend, (void *)&cwsa_hook_objc_msgSend} }, 1); If you know the reason, please tell me, thank you.

meiszhe commented 4 years ago

Have you updated your local checkout of fishhook recently? It's difficult to tell without the full crash report, but 4eeb18c fixed an issue that fits the description you provided.

I think i find the reason, {"objc_msgSend", cwsa_hook_objc_msgSend, (void *)&cwsa_hook_objc_msgSend}should be {"objc_msgSend", cwsa_hook_objc_msgSend, (void *)&cwsa_orig_objc_msgSend}. I changed this, and the crash disappeared.

swolchok commented 4 years ago

Glad you were able to get it fixed!

Joan0018 commented 2 years ago

Have you updated your local checkout of fishhook recently? It's difficult to tell without the full crash report, but 4eeb18c fixed an issue that fits the description you provided.

Hello, i updated my local checkout, but the crash occured again. if (cur->rebindings[j].replaced != NULL && indirect_symbol_bindings[i] != cur->rebindings[j].replacement) { *(cur->rebindings[j].replaced) = indirect_symbol_bindings[i]; } Crash Info : Thread 1: EXC_BAD_ACCESS (code=2, address=0x106ea8c90) I use fishhook (I add 'cwsa' prefix ): const struct mach_header *header = _dyld_get_image_header(index); intptr_t slide = _dyld_get_image_vmaddr_slide(index); cwsa_rebind_symbols_image(header, slide, (struct cwsa_rebinding[1]){ {"objc_msgSend", cwsa_hook_objc_msgSend, (void *)&cwsa_hook_objc_msgSend} }, 1); If you know the reason, please tell me, thank you.

May I know, where did I add this? currently facing the same issue

XCode version: 13.2.1 MacOS version: 12.1 RN version 0.59