Fix possible crash
This commit is contained in:
parent
2428fd2ffc
commit
ac5389e21f
|
|
@ -130,7 +130,7 @@ static int replaceMethod(void *fromMethod, void *toMethod, int isBackup) {
|
||||||
void *originEntrypoint = readAddr((char *) toMethod + OFFSET_entry_point_from_quick_compiled_code_in_ArtMethod);
|
void *originEntrypoint = readAddr((char *) toMethod + OFFSET_entry_point_from_quick_compiled_code_in_ArtMethod);
|
||||||
// entry point hardcoded
|
// entry point hardcoded
|
||||||
newEntrypoint = genTrampoline(toMethod, originEntrypoint);
|
newEntrypoint = genTrampoline(toMethod, originEntrypoint);
|
||||||
replaced_entrypoint[fromMethod] = newEntrypoint;
|
replaced_entrypoint[toMethod] = originEntrypoint;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// entry point from ArtMethod struct
|
// entry point from ArtMethod struct
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ namespace art {
|
||||||
CREATE_HOOK_STUB_ENTRIES(void *, GetOatQuickMethodHeader, void *thiz, uintptr_t pc) {
|
CREATE_HOOK_STUB_ENTRIES(void *, GetOatQuickMethodHeader, void *thiz, uintptr_t pc) {
|
||||||
// This is a partial copy from AOSP. We only touch them if they are hooked.
|
// This is a partial copy from AOSP. We only touch them if they are hooked.
|
||||||
if (UNLIKELY(edxp::isHooked(thiz))) {
|
if (UNLIKELY(edxp::isHooked(thiz))) {
|
||||||
uintptr_t original_ep = reinterpret_cast<uintptr_t>(getOriginalEntryPointFromTargetMethod(
|
uintptr_t original_ep = reinterpret_cast<uintptr_t>(
|
||||||
thiz));
|
getOriginalEntryPointFromTargetMethod(thiz));
|
||||||
if (original_ep) {
|
if (original_ep) {
|
||||||
char *code_length_loc =
|
char *code_length_loc =
|
||||||
reinterpret_cast<char *>(original_ep) + oat_header_code_length_offset;
|
reinterpret_cast<char *>(original_ep) + oat_header_code_length_offset;
|
||||||
|
|
@ -53,7 +53,8 @@ namespace art {
|
||||||
LOGD("art_method::GetOatQuickMethodHeader: PC not found in current method.");
|
LOGD("art_method::GetOatQuickMethodHeader: PC not found in current method.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
LOGD("art_method::GetOatQuickMethodHeader: isHooked but not backup, fallback to system");
|
LOGD("art_method::GetOatQuickMethodHeader: ArtMethod=%p (%s), isHooked=true, pc=0x%x, isHooked but not backup, fallback to system",
|
||||||
|
thiz, PrettyMethod(thiz).c_str(), pc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return GetOatQuickMethodHeaderBackup(thiz, pc);
|
return GetOatQuickMethodHeaderBackup(thiz, pc);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue