Skip to content

Commit

Permalink
Kunitsu-Gami: Fix static table locator/heuristic
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Jul 2, 2024
1 parent 1f64981 commit 2939d57
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion shared/sdk/REContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ namespace sdk {
if (s_global_context != nullptr && *s_global_context != nullptr) {
auto static_tbl = (REStaticTbl**)((uintptr_t)*s_global_context + s_static_tbl_offset);
bool found_static_tbl_offset = false;
if (IsBadReadPtr(*static_tbl, sizeof(void*)) || ((uintptr_t)*static_tbl & (sizeof(void*) - 1)) != 0) {
const auto before_static_tbl_size = *(uint32_t*)((uintptr_t)static_tbl + sizeof(void*));
spdlog::info("[VM::update_pointers] Static table size (before): {}", *(uint32_t*)((uintptr_t)static_tbl + sizeof(void*)));
if (IsBadReadPtr(*static_tbl, sizeof(void*)) || ((uintptr_t)*static_tbl & (sizeof(void*) - 1)) != 0 || before_static_tbl_size > 9999999 || before_static_tbl_size < 2000) {
spdlog::info("[VM::update_pointers] Static table offset is bad, correcting...");

// We are looking for the two arrays, the static field table, and the static field "initialized table"
Expand Down

0 comments on commit 2939d57

Please sign in to comment.