Skip to content

Commit

Permalink
Fix Dobby hook fallback
Browse files Browse the repository at this point in the history
Even if dladdr could not find function name for an address given by
art_symbol_resolver, we should still process inline hook.

Close #32 as completed, close #39 as merged
  • Loading branch information
JingMatrix committed Oct 17, 2024
1 parent 29b0163 commit c350b6a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions core/src/main/jni/include/native_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ inline int HookPLT(void *art_symbol, void *callback, void **backup, bool save =
}

if (auto addr = GetArt()->getSymbAddress(symbol); addr) {
Dl_info info;
if (dladdr(addr, &info) && info.dli_sname != nullptr && strcmp(info.dli_sname, symbol) == 0)
HookInline(addr, callback, backup);
HookInline(addr, callback, backup);
} else if (*backup == nullptr && isDebug) {
LOGW("Failed to {} Art symbol {}", save ? "hook" : "unhook", symbol);
}
Expand Down

0 comments on commit c350b6a

Please sign in to comment.