Ensure the function pointer being returned is from an active method. (#35750)
authorAaron Robinson <arobins@microsoft.com>
Sun, 3 May 2020 00:39:18 +0000 (17:39 -0700)
committerGitHub <noreply@github.com>
Sun, 3 May 2020 00:39:18 +0000 (17:39 -0700)
src/coreclr/src/vm/runtimehandles.cpp

index 2b4cad2..2a80972 100644 (file)
@@ -1752,10 +1752,13 @@ void * QCALLTYPE RuntimeMethodHandle::GetFunctionPointer(MethodDesc * pMethod)
 {
     QCALL_CONTRACT;
 
-    void* funcPtr = 0;
+    void* funcPtr = NULL;
 
     BEGIN_QCALL;
 
+    // Ensure the method is active so
+    // the function pointer can be used.
+    pMethod->EnsureActive();
     funcPtr = (void*)pMethod->GetMultiCallableAddrOfCode();
 
     END_QCALL;