From 10b057a0f39212386c07c36dbcc03e0555066ae3 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Wed, 12 Jun 2019 13:27:12 +0200 Subject: [PATCH] Fix Module::IsInSameVersionBubble contract (#25106) * Fix Module::IsInSameVersionBubble contract The function had an incorrect contract indicating that it cannot throw and that it cannot trigger GC. This is not true in case the underlying GetNativeAssemblyImport loads the manifest. Change the contract to STANDARD_VM_CONTRACT --- src/vm/ceeload.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index 49d5fb5..b1ee606 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -3420,22 +3420,16 @@ BOOL Module::IsInCurrentVersionBubble() // BOOL Module::IsInSameVersionBubble(Module *target) { - CONTRACT(BOOL) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACT_END; + STANDARD_VM_CONTRACT; if (this == target) { - RETURN TRUE; + return TRUE; } if (!HasNativeOrReadyToRunImage()) { - RETURN FALSE; + return FALSE; } // Check if the current module's image has native manifest metadata, otherwise the current->GetNativeAssemblyImport() asserts. @@ -3443,7 +3437,7 @@ BOOL Module::IsInSameVersionBubble(Module *target) const void* pMeta = GetFile()->GetOpenedILimage()->GetNativeManifestMetadata(&cMeta); if (pMeta == NULL) { - RETURN FALSE; + return FALSE; } IMDInternalImport* pMdImport = GetNativeAssemblyImport(); @@ -3459,11 +3453,11 @@ BOOL Module::IsInSameVersionBubble(Module *target) hr = pMdImport->GetAssemblyRefProps(assemblyRef, NULL, NULL, &assemblyName, NULL, NULL, NULL, NULL); if (strcmp(assemblyName, targetName) == 0) { - RETURN TRUE; + return TRUE; } } - RETURN FALSE; + return FALSE; } #endif // FEATURE_READYTORUN && !FEATURE_READYTORUN_COMPILER -- 2.7.4