Commit 3881352b authored by swift_gan's avatar swift_gan

fix crash when use replace hook

parent 43ada919
......@@ -113,9 +113,6 @@ bool doHookWithReplacement(JNIEnv* env,
hookMethod->compile(env);
if (backupMethod != nullptr) {
if (!backupMethod->isCompiled()) {
backupMethod->compile(env);
}
originMethod->backup(backupMethod);
if (SDK_INT >= ANDROID_N) {
backupMethod->disableCompilable();
......@@ -165,9 +162,7 @@ bool doHookWithInline(JNIEnv* env,
art::mirror::ArtMethod *backupMethod) {
//fix >= 8.1
if (!hookMethod->isCompiled()) {
hookMethod->compile(env);
}
hookMethod->compile(env);
if (SDK_INT >= ANDROID_N) {
originMethod->disableCompilable();
......
......@@ -145,7 +145,7 @@ namespace SandHook {
hookTrampoline->replacement = replacementHookTrampoline;
hookTrampoline->originCode = static_cast<Code>(originMethod->getQuickCodeEntry());
if (SWITCH_SETX0 && SDK_INT >= ANDROID_O && backupMethod != nullptr) {
if (SWITCH_SETX0 && SDK_INT >= ANDROID_N && backupMethod != nullptr) {
callOriginTrampoline = new CallOriginTrampoline();
checkThumbCode(callOriginTrampoline, getEntryCode(originMethod));
callOriginTrampoline->init();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment