Fix dump generation segfault in DAC (#58537)
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Thu, 2 Sep 2021 17:31:48 +0000 (10:31 -0700)
committerGitHub <noreply@github.com>
Thu, 2 Sep 2021 17:31:48 +0000 (10:31 -0700)
Issue: https://github.com/dotnet/runtime/issues/58525

Co-authored-by: Mike McLaughlin <mikem@microsoft.com>
src/coreclr/vm/excep.cpp
src/coreclr/vm/exceptmacros.h

index 5249ea7..a6bf988 100644 (file)
@@ -11533,8 +11533,9 @@ VOID ThrowBadFormatWorker(UINT resID, LPCWSTR imageName DEBUGARG(__in_z const ch
         msgStr += W(")");
     }
 #endif
-
     ThrowHR(COR_E_BADIMAGEFORMAT, msgStr);
+#else // DACCESS_COMPILE
+    ThrowHR(COR_E_BADIMAGEFORMAT);
 #endif // #ifndef DACCESS_COMPILE
 }
 
index 7e3a058..3fefb79 100644 (file)
@@ -515,8 +515,12 @@ template <typename T>
 NOINLINE
 VOID ThrowBadFormatWorkerT(UINT resID, T * pImgObj DEBUGARG(__in_z const char *cond))
 {
+#ifdef DACCESS_COMPILE
+    ThrowBadFormatWorker(resID, nullptr DEBUGARG(cond));
+#else
     LPCWSTR tmpStr = GetPathForErrorMessagesT(pImgObj);
     ThrowBadFormatWorker(resID, tmpStr DEBUGARG(cond));
+#endif
 }