Skip to content

Commit 11e367d

Browse files
committed
ReviveXR: Fix stack overflow on hooked function.
1 parent e139e30 commit 11e367d

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

ReviveXR/REV_CAPI_D3D.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@
1515

1616
LONG DetourVirtual(PVOID pInstance, UINT methodPos, PVOID *ppPointer, PVOID pDetour)
1717
{
18-
LPVOID* pVMT = *((LPVOID**)pInstance);
19-
LPVOID pTarget = pVMT[methodPos];
18+
if (!pInstance || !ppPointer)
19+
return ERROR_INVALID_PARAMETER;
2020

21-
if (ppPointer != NULL)
22-
{
23-
*ppPointer = pTarget;
24-
}
25-
26-
return DetourAttach(&pTarget, pDetour);
21+
LPVOID* pVMT = *((LPVOID**)pInstance);
22+
*ppPointer = pVMT[methodPos];
23+
return DetourAttach(ppPointer, pDetour);
2724
}
2825

2926
typedef HRESULT(WINAPI* _CreateRenderTargetView)(

0 commit comments

Comments
 (0)