From 4a1fad86abf41f5fa08197091fc15917f59d2bf5 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Mon, 4 Nov 2019 15:43:56 -0800 Subject: [PATCH] Avoid instantiating abstract class (dotnet/coreclr#27589) Commit migrated from https://github.com/dotnet/coreclr/commit/0b441193b7b701c4b68d758c4798f28241cfb9e3 --- .../ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs index e91cc07..0fefb69 100644 --- a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs +++ b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs @@ -758,6 +758,11 @@ namespace Internal.JitInterface private CorInfoHelpFunc getNewHelper(ref CORINFO_RESOLVED_TOKEN pResolvedToken, CORINFO_METHOD_STRUCT_* callerHandle, byte* pHasSideEffects = null) { TypeDesc type = HandleToObject(pResolvedToken.hClass); + MetadataType metadataType = type as MetadataType; + if (metadataType != null && metadataType.IsAbstract) + { + ThrowHelper.ThrowInvalidProgramException(ExceptionStringID.InvalidProgramSpecific, HandleToObject(callerHandle)); + } if (pHasSideEffects != null) { -- 2.7.4