Update portable executable and import table validation (#21109)
commit718bef874e3ed0d2efd11bc787cde5d4d11a9df9
authorBill Holmes <bill.holmes@unity3d.com>
Thu, 19 Aug 2021 16:06:29 +0000 (19 12:06 -0400)
committerGitHub <noreply@github.com>
Thu, 19 Aug 2021 16:06:29 +0000 (19 18:06 +0200)
tree5130eeaf5bd3fd1eacebbdbb3c0f7460b47abc6d
parent2441bac6cbdabf3262ce032554a91198f53bc2c7
Update portable executable and import table validation (#21109)

* Update portable executable and import table validation

Update the SectionAlignment and FileAlignment validate to match the
ms docs...

https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#optional-header-windows-specific-fields-image-only

"SectionAlignment
The alignment (in bytes) of sections when they are loaded into memory
It must be greater than or equal to FileAlignment. The default is the
page size for the architecture."

"FileAlignment
The alignment factor (in bytes) that is used to align the raw data of
sections in the image file. The value should be a power of 2 between 512
and 64 K, inclusive. The default is 512. If the SectionAlignment is less
than the architecture's page size, then FileAlignment must match
SectionAlignment."

For the import table use a case insensitive compare for the mscoree.dll
file name.

* Fixing a error message typo...

"Aligmnent" to "Alignment"
mono/metadata/metadata-verify.c