From 81e304288cab93a1c688baa876b5608b5c39f6ea Mon Sep 17 00:00:00 2001 From: KitRifty Date: Sun, 11 Feb 2024 22:51:03 +0000 Subject: [PATCH] Fix entity input functions crashing on invocation - In x64, there's a tendency for jmp calls to be used to go to another function instead of using call. There's probably some stack fuckery going on here since call pushes the return address on the stack. However, since we don't need to use the stack, we can substitute this with a simple jmp reg call instead, which also fixes the crash. --- extension/idatamapcontainer.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/extension/idatamapcontainer.cpp b/extension/idatamapcontainer.cpp index 909dc52..4457173 100644 --- a/extension/idatamapcontainer.cpp +++ b/extension/idatamapcontainer.cpp @@ -782,12 +782,11 @@ void IEntityDataMapInputFuncDelegate::Alloc() // (IEntityDataMapInputFuncDelegate* pDelegate, CBaseEntity* pEntity, inputdata_t &data) // this::(inputdata_t &) // RDI, RSI, RDX, RCX, R8, R9 - 0x48, 0x89, 0xF2, // mov RDX, RSI - 3rd arg - 0x48, 0x89, 0xFE, // mov RSI, RDI - 0x48, 0xBF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // mov rdi, thisAddr - 0x48, 0xB9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // mov r9, callFuncAddr - 0x41, 0xFF, 0xD1, // call r9 - 0xC3 // ret + 0x48, 0x89, 0xF2, // mov RDX, RSI - 3rd arg + 0x48, 0x89, 0xFE, // mov RSI, RDI + 0x48, 0xBF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // movabs rdi, thisAddr + 0x49, 0xB9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // movabs r9, callFuncAddr + 0x41, 0xFF, 0xE1 // jmp r9 #endif #else #ifdef WIN32