Fix an AV in crossgen caused by invalid profiling data (dotnet/coreclr#27842)
authorFadi Hanna <fadim@microsoft.com>
Tue, 12 Nov 2019 23:32:30 +0000 (15:32 -0800)
committerGitHub <noreply@github.com>
Tue, 12 Nov 2019 23:32:30 +0000 (15:32 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/e40384b6dfcbd8db3a817528f5619de31dab4e0b

src/coreclr/src/vm/ceeload.cpp

index d108813..f0c0c44 100644 (file)
@@ -7814,10 +7814,14 @@ void Module::ExpandAll(DataImage *image)
                 if (TypeFromToken(token) == mdtMethodDef)
                 {
                     MethodDesc *  pMD = LookupMethodDef(token);
-                    //
-                    // Record a reference to a hot non-generic method
-                    //
-                    image->GetPreloader()->MethodReferencedByCompiledCode((CORINFO_METHOD_HANDLE)pMD);
+
+                    if (pMD != NULL)
+                    {
+                        //
+                        // Record a reference to a hot non-generic method
+                        //
+                        image->GetPreloader()->MethodReferencedByCompiledCode((CORINFO_METHOD_HANDLE)pMD);
+                    }
                 }
                 else if (TypeFromToken(token) == ibcMethodSpec)
                 {