From f6fe457f9483c614afde7c89f6ae414e476c84b2 Mon Sep 17 00:00:00 2001 From: Steve MacLean Date: Thu, 30 Mar 2017 22:06:23 -0400 Subject: [PATCH] Add assert to GCHeap::ValidateObjectMember (dotnet/coreclr#10591) In presence of a corrupt heap, objects can contain null method table. Add assertion to prevent segfault in checked/debug builds. Commit migrated from https://github.com/dotnet/coreclr/commit/07fa3a32336d2da5d2bf652ad01d33f18b2debaf --- src/coreclr/src/gc/gc.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/src/gc/gc.cpp b/src/coreclr/src/gc/gc.cpp index 9435357..65c6742 100644 --- a/src/coreclr/src/gc/gc.cpp +++ b/src/coreclr/src/gc/gc.cpp @@ -33501,6 +33501,7 @@ void GCHeap::ValidateObjectMember (Object* obj) { dprintf (3, ("VOM: m: %Ix obj %Ix", (size_t)child_o, o)); MethodTable *pMT = method_table (child_o); + assert(pMT); if (!pMT->SanityCheck()) { dprintf (3, ("Bad member of %Ix %Ix", (size_t)oo, (size_t)child_o)); -- 2.7.4