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>
BOOL DacValidateMethodTable(PTR_MethodTable pMT, BOOL &bIsFree)
{
+ bIsFree = FALSE;
+
+ if ((pMT == NULL) || dac_cast<TADDR>(pMT) == (TADDR)-1)
+ {
+ return FALSE;
+ }
+
// Verify things are right.
BOOL retval = FALSE;
EX_TRY
{
- bIsFree = FALSE;
if (HOST_CDADDR(pMT) == HOST_CDADDR(g_pFreeObjectMethodTable))
{
bIsFree = TRUE;
BOOL DacValidateMD(PTR_MethodDesc pMD)
{
- if (pMD == NULL)
+ if ((pMD == NULL) || dac_cast<TADDR>(pMD) == (TADDR)-1)
{
return FALSE;
}