Skip to content

Commit

Permalink
Safer vtable access
Browse files Browse the repository at this point in the history
  • Loading branch information
Soreepeong committed Dec 17, 2023
1 parent 61ec7c7 commit 077eae7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dalamud/ImGuiScene/Helpers/ReShadePeeler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ private static bool BelongsInReShadeDll(nint ptr)
private static bool IsReShadedComObject<T>(T* obj)
where T : unmanaged, IUnknown.Interface
{
var vtbl = (nint*)((IUnknown*)obj)->lpVtbl;
try
{
var vtbl = (nint**)Marshal.ReadIntPtr((nint)obj);
for (var i = 0; i < 3; i++)
{
if (!BelongsInReShadeDll(Marshal.ReadIntPtr((nint)(&vtbl[i]))))
if (!BelongsInReShadeDll(Marshal.ReadIntPtr((nint)(vtbl + i))))
return false;
}

Expand Down

0 comments on commit 077eae7

Please sign in to comment.