ildasm -nat only works for fragile native images (ie CoreLib only by default).
Running ildasm -nat against unsupported native images would cause a segmentation fault. This PR checks pNativeHeader->Signature == CORCOMPILE_SIGNATURE and end the program with a meaningful error message.
fix #10247
}
CORCOMPILE_HEADER * pNativeHeader;
g_pPELoader->getVAforRVA(VAL32(g_CORHeader->ManagedNativeHeader.VirtualAddress), (void**)&pNativeHeader);
+
+ if (pNativeHeader->Signature != CORCOMPILE_SIGNATURE)
+ {
+ printError( g_pFile, "/native only works on NGen images." );
+ goto exit;
+ }
+
g_pPELoader->getVAforRVA(VAL32(pNativeHeader->ManifestMetaData.VirtualAddress), &g_pMetaData);
g_cbMetaData = VAL32(pNativeHeader->ManifestMetaData.Size);
}