Fix random crash

This commit is contained in:
Nullptr
2023-02-02 14:57:43 +08:00
parent 94b56e1b2f
commit 581506a1b5
4 changed files with 3 additions and 404 deletions
+2 -6
View File
@@ -14,7 +14,6 @@
#include "dl.h"
#include "daemon.h"
#include "elf_util.h"
#include "zygisk.hpp"
#include "memory.hpp"
#include "module.hpp"
@@ -743,11 +742,8 @@ void hook_functions() {
if (old_jniRegisterNativeMethods == nullptr) {
do {
LOGD("jniRegisterNativeMethods not hooked, using fallback\n");
SandHook::ElfImg art("libandroid_runtime.so");
auto *GetRuntime = art.getSymbAddress<void*(*)()>("_ZN7android14AndroidRuntime10getRuntimeEv");
constexpr char sig[] = "_ZN7android14AndroidRuntime10getRuntimeEv";
auto *GetRuntime = (void*(*)()) dlsym(RTLD_DEFAULT, sig);
if (GetRuntime == nullptr) {
LOGE("GetRuntime is nullptr");
break;