Fix segmentation fault when using ZapImage::PrintStats() (dotnet/coreclr#9731)
authorSujin Kim <sjsujin.kim@samsung.com>
Fri, 24 Feb 2017 14:43:15 +0000 (23:43 +0900)
committerJan Kotas <jkotas@microsoft.com>
Fri, 24 Feb 2017 14:43:15 +0000 (06:43 -0800)
commit6adfeb6fc4d83f52ba72f7f6c41c6e64b7ffa5fe
tree77b6f84f55e0982602d99f6e619ecd240ed5662d
parent38a4bc08e57d429f9ba3b4c87afe01ac176f2382
Fix segmentation fault when using ZapImage::PrintStats() (dotnet/coreclr#9731)

Currently, ZapImage::PrintStats is not used anywhere. But I want to get detailed informations about Native Image(ni.dll) components.
So I just used ZapImage::PrintStats when called ZapImage::SaveImage. After that I met the segmentation fault likes dotnet/coreclr#9680.

I found the reason for this issue is accessing the null pointer to get sizes.

Commit migrated from https://github.com/dotnet/coreclr/commit/e876e8147d06a213f562021a4d02a5a60ba63c99
src/coreclr/src/zap/zapheaders.cpp
src/coreclr/src/zap/zapimage.cpp