diff --git a/core/src/main/cpp/CMakeLists.txt b/core/src/main/cpp/CMakeLists.txt index 7032ee3..ac59f73 100644 --- a/core/src/main/cpp/CMakeLists.txt +++ b/core/src/main/cpp/CMakeLists.txt @@ -61,6 +61,10 @@ add_library(pine SHARED ${PINE_SOURCES}) find_library(log-lib log) find_package(cxx REQUIRED CONFIG) +# support 16KB +target_link_options(pine PRIVATE "-Wl,-z,max-page-size=16384") +target_link_options(pine PRIVATE "-Wl,-z,common-page-size=16384") + target_link_libraries(pine ${log-lib} cxx::cxx) ENABLE_LANGUAGE(ASM) diff --git a/core/src/main/cpp/pine.cpp b/core/src/main/cpp/pine.cpp index 4b1cbd3..c2bb336 100644 --- a/core/src/main/cpp/pine.cpp +++ b/core/src/main/cpp/pine.cpp @@ -505,6 +505,10 @@ void Pine_getArgsX86(JNIEnv* env, jclass, jint javaExtras, jintArray javaArray, #endif void Pine_syncMethodInfo(JNIEnv* env, jclass, jobject javaOrigin, jobject javaBackup, jboolean skipDeclaringClass) { + if (javaOrigin == nullptr || javaBackup == nullptr) { + LOGW("syncMethodInfo: javaOrigin or javaBackup is null"); + return; + } auto origin = art::ArtMethod::FromReflectedMethod(env, javaOrigin); auto backup = art::ArtMethod::FromReflectedMethod(env, javaBackup); diff --git a/core/src/main/java/top/canyie/pine/Pine.java b/core/src/main/java/top/canyie/pine/Pine.java index 19be477..d5427e6 100644 --- a/core/src/main/java/top/canyie/pine/Pine.java +++ b/core/src/main/java/top/canyie/pine/Pine.java @@ -494,7 +494,15 @@ static Object callBackupMethod(HookRecord hookRecord, Object thisObject, Object[ // native entry of JNI method may be changed by RegisterNatives and UnregisterNatives, // so we need to update them when invoke backup method. Member origin = hookRecord.target; + if (origin == null) { + Log.w(TAG, "Target method is null!!!"); + return null; + } Method backup = hookRecord.backup; + if (backup == null) { + Log.w(TAG, "Backup method is null for " + hookRecord.target); + return null; + } Class declaring = origin.getDeclaringClass(); syncMethodInfo(origin, backup, hookRecord.skipUpdateDeclaringClass); // FIXME: GC happens here (you can add Runtime.getRuntime().gc() to test) will crash backup calling diff --git a/gradlew b/gradlew old mode 100644 new mode 100755