From 3fd7b29d64e286d3c9cb7c9de0c725d29873e301 Mon Sep 17 00:00:00 2001 From: GoD-Tony Date: Fri, 20 Jan 2017 16:13:31 +0100 Subject: [PATCH] Fix GDC's Linux sigscanning (#576) The pointer returned by dlopen is not inside the loaded librarys memory region. --- tools/gdc-psyfork/gdc.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/gdc-psyfork/gdc.cpp b/tools/gdc-psyfork/gdc.cpp index 15669e3f..c9ca7bbf 100644 --- a/tools/gdc-psyfork/gdc.cpp +++ b/tools/gdc-psyfork/gdc.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "gdc.h" #include "GameConfigs.h" #include "MemoryUtils.h" @@ -619,7 +620,10 @@ int checkSigStringL(void *handle, const char* symbol) if (real_bytes >= 1) { - mu.FindPattern(handle, (char*)real_sig, real_bytes, matches, dummy); + // The pointer returned by dlopen is not inside the loaded librarys memory region. + struct link_map *dlmap = (struct link_map *)handle; + + mu.FindPattern((void *)dlmap->l_addr, (char*)real_sig, real_bytes, matches, dummy); } }