Skip to content

Commit 52f3d10

Browse files
Make DacValidateMD and DacValidateMethodTable more resilient (#90797)
Make both methods more resilient to the case of invalid MethodDesc and MethodTable with value -1. Close #90691 Co-authored-by: Jan Vorlicek <janvorli@microsoft.com>
1 parent 149a289 commit 52f3d10

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/coreclr/debug/daccess/request.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,17 @@ BOOL DacValidateEEClass(PTR_EEClass pEEClass)
135135

136136
BOOL DacValidateMethodTable(PTR_MethodTable pMT, BOOL &bIsFree)
137137
{
138+
bIsFree = FALSE;
139+
140+
if ((pMT == NULL) || dac_cast<TADDR>(pMT) == (TADDR)-1)
141+
{
142+
return FALSE;
143+
}
144+
138145
// Verify things are right.
139146
BOOL retval = FALSE;
140147
EX_TRY
141148
{
142-
bIsFree = FALSE;
143149
if (HOST_CDADDR(pMT) == HOST_CDADDR(g_pFreeObjectMethodTable))
144150
{
145151
bIsFree = TRUE;
@@ -182,7 +188,7 @@ BadMethodTable: ;
182188

183189
BOOL DacValidateMD(PTR_MethodDesc pMD)
184190
{
185-
if (pMD == NULL)
191+
if ((pMD == NULL) || dac_cast<TADDR>(pMD) == (TADDR)-1)
186192
{
187193
return FALSE;
188194
}

0 commit comments

Comments
 (0)