From 1e502ff8252f1e1939385053e8f492286f7d29d2 Mon Sep 17 00:00:00 2001 From: hujin Date: Fri, 18 Nov 2022 10:54:53 +0800 Subject: [PATCH] Fixed memory copy error of virtual table under multiple inheritance --- src/Runtime/VTables.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Runtime/VTables.cs b/src/Runtime/VTables.cs index a7fc1e7547..ea4d6c7163 100644 --- a/src/Runtime/VTables.cs +++ b/src/Runtime/VTables.cs @@ -49,7 +49,7 @@ public T GetMethodDelegate(short table, int slot, short specialiation = 0) wh public unsafe static IntPtr* CloneTable(List cache, IntPtr instance, int offset, int size, int offsetRTTI) { var sizeInBytes = (size + offsetRTTI) * sizeof(IntPtr); - var src = (((*(IntPtr*)instance) + offset) - offsetRTTI * sizeof(IntPtr)).ToPointer(); + var src = (*(IntPtr**)(instance + offset) - offsetRTTI); var entries = (IntPtr*)Marshal.AllocHGlobal(sizeInBytes); Buffer.MemoryCopy(src, entries, sizeInBytes, sizeInBytes);