Fix some bugs

This commit is contained in:
LoveSy 2022-02-18 02:25:06 +08:00
parent bc20e3cf11
commit 88bef4d96c
3 changed files with 5 additions and 3 deletions

View File

@ -33,7 +33,7 @@ public:
if (!RETRIEVE_MEM_FUNC_SYMBOL(SetJavaDebuggable, "_ZN3art7Runtime17SetJavaDebuggableEb")) {
return false;
}
return false;
return true;
}
};

View File

@ -111,7 +111,7 @@ public:
jmethodID get_declared_constructors = JNI_GetMethodID(env, clazz, "getDeclaredConstructors",
"()[Ljava/lang/reflect/Constructor;");
auto constructors = JNI_Cast<jobjectArray>(
JNI_CallObjectMethod(env, clazz, get_declared_constructors));
JNI_CallObjectMethod(env, throwable, get_declared_constructors));
auto length = JNI_GetArrayLength(env, constructors);
if (length < 2) {
LOGE("Throwable has less than 2 constructors");

View File

@ -20,6 +20,7 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma ide diagnostic ignored "ConstantConditionsOC"
#pragma ide diagnostic ignored "Simplify"
#pragma ide diagnostic ignored "UnreachableCode"
namespace lsplant {
@ -139,8 +140,9 @@ inline void UpdateTrampoline(decltype(entry_point_offset) offset) {
}
bool InitNative(JNIEnv *env, const HookHandler &handler) {
if (!handler.inline_hooker || !handler.inline_unhooker || !handler.art_symbol_resolver)
if (!handler.inline_hooker || !handler.inline_unhooker || !handler.art_symbol_resolver) {
return false;
}
if (!Runtime::Init(handler)) {
LOGE("Failed to init runtime");
return false;