[core] Do not allow hooking inner methods (#846)

This commit is contained in:
LoveSy 2021-08-06 14:18:28 +08:00 committed by GitHub
parent 10a2ae56a6
commit 36a1fe03e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -174,6 +174,8 @@ public final class XposedBridge {
}*/ }*/
else if (Modifier.isAbstract(hookMethod.getModifiers())) { else if (Modifier.isAbstract(hookMethod.getModifiers())) {
throw new IllegalArgumentException("Cannot hook abstract methods: " + hookMethod.toString()); throw new IllegalArgumentException("Cannot hook abstract methods: " + hookMethod.toString());
} else if (hookMethod.getDeclaringClass().getClassLoader() == XposedBridge.class.getClassLoader()) {
throw new IllegalArgumentException("Do not allow hooking inner methods");
} }
Executable targetMethod = (Executable) hookMethod; Executable targetMethod = (Executable) hookMethod;