diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index 07208001b0c3b..878317b4ceb29 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -5650,10 +5650,13 @@ void DacDbiInterfaceImpl::LookupEnCVersions(Module* pModule, DebuggerJitInfo * pDJI = NULL; EX_TRY_ALLOW_DATATARGET_MISSING_MEMORY { - pDMI = g_pDebugger->GetOrCreateMethodInfo(pModule, mdMethod); - if (pDMI != NULL) + if (g_pDebugger != NULL) { - pDJI = pDMI->FindJitInfo(pMD, CORDB_ADDRESS_TO_TADDR(pNativeStartAddress)); + pDMI = g_pDebugger->GetOrCreateMethodInfo(pModule, mdMethod); + if (pDMI != NULL) + { + pDJI = pDMI->FindJitInfo(pMD, CORDB_ADDRESS_TO_TADDR(pNativeStartAddress)); + } } } EX_END_CATCH_ALLOW_DATATARGET_MISSING_MEMORY; @@ -7512,6 +7515,10 @@ HRESULT DacDbiInterfaceImpl::GetDefinesBitField(ULONG32 *pDefines) DD_ENTER_MAY_THROW; if (pDefines == NULL) return E_INVALIDARG; + + if (g_pDebugger == NULL) + return CORDBG_E_NOTREADY; + *pDefines = g_pDebugger->m_defines; return S_OK; } @@ -7521,6 +7528,10 @@ HRESULT DacDbiInterfaceImpl::GetMDStructuresVersion(ULONG32* pMDStructuresVersio DD_ENTER_MAY_THROW; if (pMDStructuresVersion == NULL) return E_INVALIDARG; + + if (g_pDebugger == NULL) + return CORDBG_E_NOTREADY; + *pMDStructuresVersion = g_pDebugger->m_mdDataStructureVersion; return S_OK; } diff --git a/src/coreclr/debug/di/module.cpp b/src/coreclr/debug/di/module.cpp index 15fae1581e2bf..fbb6f81a1d952 100644 --- a/src/coreclr/debug/di/module.cpp +++ b/src/coreclr/debug/di/module.cpp @@ -4250,12 +4250,12 @@ HRESULT CordbNativeCode::GetILToNativeMapping(ULONG32 cMap, LoadNativeInfo(); SequencePoints * pSeqPts = GetSequencePoints(); - DebuggerILToNativeMap * rgMapInt = pSeqPts->GetMapAddr(); ULONG32 cMapIntCount = pSeqPts->GetEntryCount(); // If they gave us space to copy into... - if (map != NULL) + if (map != NULL && cMapIntCount != 0) { + DebuggerILToNativeMap * rgMapInt = pSeqPts->GetMapAddr(); // Only copy as much as either they gave us or we have to copy. ULONG32 cMapToCopy = min(cMap, cMapIntCount); diff --git a/src/coreclr/utilcode/collections.cpp b/src/coreclr/utilcode/collections.cpp index ed5271fde77f8..1896d702b5e73 100644 --- a/src/coreclr/utilcode/collections.cpp +++ b/src/coreclr/utilcode/collections.cpp @@ -268,6 +268,12 @@ BYTE *CHashTable::FindNextEntry( // The next entry, or0 for end of list. if (psSrch->iNext != UINT32_MAX) { psEntry = EntryPtr(psSrch->iNext); +#if DACCESS_COMPILE + // If there is a simple infinite loop in the linked list + // If more complex forms of infinite loops are present, this code may need to be adjusted to handle an arbitrary cycle. + if (psEntry->iNext == psSrch->iNext) + return NULL; +#endif psSrch->iNext = psEntry->iNext; return ((BYTE *) psEntry); }