Change bIsFree check in DacValidateMethodTable (#1086)
authorDong-Heon Jung <dheon.jung@samsung.com>
Mon, 23 Dec 2019 19:11:43 +0000 (04:11 +0900)
committerJan Kotas <jkotas@microsoft.com>
Mon, 23 Dec 2019 19:11:43 +0000 (11:11 -0800)
Some commands of SOS validate a method table in DacValidateMethodTable.
In the function, it checks whether a method table is FreeObjectMethodTable or not with GetClass() value.
However, GetClass() should not be NULL. (There is an assert in GetClass())
In this patch, it compares pMT address with g_pFreeObjectMethodTable address only.

src/coreclr/src/debug/daccess/request.cpp

index fb556d5..de9790b 100644 (file)
@@ -129,15 +129,8 @@ BOOL DacValidateMethodTable(MethodTable *pMT, BOOL &bIsFree)
     EX_TRY
     {
         bIsFree = FALSE;
-        EEClass *pEEClass = pMT->GetClass();
-        if (pEEClass==NULL)
+        if (HOST_CDADDR(pMT) == HOST_CDADDR(g_pFreeObjectMethodTable))
         {
-            // Okay to have a NULL EEClass if this is a free methodtable
-            CLRDATA_ADDRESS MethTableAddr = HOST_CDADDR(pMT);
-            CLRDATA_ADDRESS FreeObjMethTableAddr = HOST_CDADDR(g_pFreeObjectMethodTable);
-            if (MethTableAddr != FreeObjMethTableAddr)
-                goto BadMethodTable;
-
             bIsFree = TRUE;
         }
         else