diff options
author | Jim Ma <mazong1123@gmail.com> | 2017-04-09 00:43:47 +0800 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-04-08 09:43:47 -0700 |
commit | 20248521af31e2307fcd728f1ebbf7877bb5ee59 (patch) | |
tree | 1560d82988840024f90aeb37e6a4c4ae44600b2f /src/ildasm | |
parent | ec80b02b61839af453ce297faf4ce074edeee9da (diff) | |
download | coreclr-20248521af31e2307fcd728f1ebbf7877bb5ee59.tar.gz coreclr-20248521af31e2307fcd728f1ebbf7877bb5ee59.tar.bz2 coreclr-20248521af31e2307fcd728f1ebbf7877bb5ee59.zip |
Exit gracefully when running ildasm -nat against unsupported ni file. (#10821)
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
Diffstat (limited to 'src/ildasm')
-rw-r--r-- | src/ildasm/dasm.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ildasm/dasm.cpp b/src/ildasm/dasm.cpp index 68cfa2abee..3d172f009e 100644 --- a/src/ildasm/dasm.cpp +++ b/src/ildasm/dasm.cpp @@ -7370,6 +7370,13 @@ BOOL DumpFile() } 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); } |