diff options
Diffstat (limited to 'src/Native/Runtime/unix/UnixNativeCodeManager.cpp')
-rw-r--r-- | src/Native/Runtime/unix/UnixNativeCodeManager.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Native/Runtime/unix/UnixNativeCodeManager.cpp b/src/Native/Runtime/unix/UnixNativeCodeManager.cpp index 480893f97..70b94e752 100644 --- a/src/Native/Runtime/unix/UnixNativeCodeManager.cpp +++ b/src/Native/Runtime/unix/UnixNativeCodeManager.cpp @@ -41,8 +41,10 @@ struct UnixNativeMethodInfo static_assert(sizeof(UnixNativeMethodInfo) <= sizeof(MethodInfo), "UnixNativeMethodInfo too big"); UnixNativeCodeManager::UnixNativeCodeManager(TADDR moduleBase, + PTR_VOID pvManagedCodeStartRange, UInt32 cbManagedCodeRange, PTR_PTR_VOID pClasslibFunctions, UInt32 nClasslibFunctions) : m_moduleBase(moduleBase), + m_pvManagedCodeStartRange(pvManagedCodeStartRange), m_cbManagedCodeRange(cbManagedCodeRange), m_pClasslibFunctions(pClasslibFunctions), m_nClasslibFunctions(nClasslibFunctions) { } @@ -54,6 +56,13 @@ UnixNativeCodeManager::~UnixNativeCodeManager() bool UnixNativeCodeManager::FindMethodInfo(PTR_VOID ControlPC, MethodInfo * pMethodInfoOut) { + // Stackwalker may call this with ControlPC that does not belong to this code manager + if (dac_cast<TADDR>(ControlPC) < dac_cast<TADDR>(m_pvManagedCodeStartRange) || + dac_cast<TADDR>(m_pvManagedCodeStartRange) + m_cbManagedCodeRange <= dac_cast<TADDR>(ControlPC)) + { + return false; + } + UnixNativeMethodInfo * pMethodInfo = (UnixNativeMethodInfo *)pMethodInfoOut; UIntNative startAddress; UIntNative lsda; @@ -396,6 +405,7 @@ bool RhRegisterOSModule(void * pModule, void ** pClasslibFunctions, UInt32 nClasslibFunctions) { NewHolder<UnixNativeCodeManager> pUnixNativeCodeManager = new (nothrow) UnixNativeCodeManager((TADDR)pModule, + pvManagedCodeStartRange, cbManagedCodeRange, pClasslibFunctions, nClasslibFunctions); if (pUnixNativeCodeManager == nullptr) |