From 077eae75977c1918c9f5c1276dd6fd84745bf869 Mon Sep 17 00:00:00 2001 From: Soreepeong Date: Mon, 18 Dec 2023 03:07:47 +0900 Subject: [PATCH] Safer vtable access --- Dalamud/ImGuiScene/Helpers/ReShadePeeler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dalamud/ImGuiScene/Helpers/ReShadePeeler.cs b/Dalamud/ImGuiScene/Helpers/ReShadePeeler.cs index 86bc88d9ee..bb3f4540f2 100644 --- a/Dalamud/ImGuiScene/Helpers/ReShadePeeler.cs +++ b/Dalamud/ImGuiScene/Helpers/ReShadePeeler.cs @@ -115,12 +115,12 @@ private static bool BelongsInReShadeDll(nint ptr) private static bool IsReShadedComObject(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; }