From 28f54a4013e85774e2a2793c5c7ca2b36948f996 Mon Sep 17 00:00:00 2001 From: Fadi Hanna Date: Fri, 4 Oct 2019 11:58:23 -0700 Subject: [PATCH] Handle AV caused by invalid IBC data (#27029) (#27034) Make FindOrCreateAssociatedMethodDesc throw a type load exception instead of an AV, which can't be handled by EX_TRY/EX_CATCH on Unix systems. --- src/vm/genmeth.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vm/genmeth.cpp b/src/vm/genmeth.cpp index 5d09cdf..d664fdc 100644 --- a/src/vm/genmeth.cpp +++ b/src/vm/genmeth.cpp @@ -802,7 +802,11 @@ MethodDesc::FindOrCreateAssociatedMethodDesc(MethodDesc* pDefMD, // Some callers pass a pExactMT that is a subtype of a parent type of pDefMD. // Find the actual exact parent of pDefMD. pExactMT = pDefMD->GetExactDeclaringType(pExactMT); - _ASSERTE(pExactMT != NULL); + if (pExactMT == NULL) + { + _ASSERTE(false); + COMPlusThrowHR(COR_E_TYPELOAD); + } if (pDefMD->HasClassOrMethodInstantiation() || !methodInst.IsEmpty()) { -- 2.7.4