From: Steve MacLean Date: Sat, 11 Feb 2017 03:53:27 +0000 (-0500) Subject: Turn segfauts into asserts in debug build (#9509) X-Git-Tag: accepted/tizen/base/20180629.140029~2277 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ac52ffaac430c929b0e80cca84bf53fdf189b41;p=platform%2Fupstream%2Fcoreclr.git Turn segfauts into asserts in debug build (#9509) * Prevent segfault if method table is null * ValidateInner() check method table is not null --- diff --git a/src/inc/stdmacros.h b/src/inc/stdmacros.h index ab77a2c..3ec8bec 100644 --- a/src/inc/stdmacros.h +++ b/src/inc/stdmacros.h @@ -277,7 +277,7 @@ inline ULONG RoundUpToPower2(ULONG x) #define DBG_GET_CLASS_NAME(pMT) \ - (pMT)->GetClass()->GetDebugClassName() + (((pMT) == NULL) ? NULL : (pMT)->GetClass()->GetDebugClassName()) #define DBG_CLASS_NAME_MT(pMT) \ (DBG_GET_CLASS_NAME(pMT) == NULL) ? "" : DBG_GET_CLASS_NAME(pMT) diff --git a/src/vm/object.cpp b/src/vm/object.cpp index b219eb9..21e56ab 100644 --- a/src/vm/object.cpp +++ b/src/vm/object.cpp @@ -1737,9 +1737,10 @@ VOID Object::ValidateInner(BOOL bDeep, BOOL bVerifyNextHeader, BOOL bVerifySyncB AVInRuntimeImplOkayHolder avOk; MethodTable *pMT = GetGCSafeMethodTable(); + lastTest = 1; - CHECK_AND_TEAR_DOWN(pMT->Validate()); + CHECK_AND_TEAR_DOWN(pMT && pMT->Validate()); lastTest = 2; bool noRangeChecks =