summaryrefslogtreecommitdiff
path: root/src/utilcode
diff options
context:
space:
mode:
authorRuben Ayrapetyan <ruben-ayrapetyan@users.noreply.github.com>2018-03-06 06:37:43 +0000
committerJan Kotas <jkotas@microsoft.com>2018-03-05 22:37:43 -0800
commit383736b96b643ba46ad290fc86601fc2d62a9436 (patch)
tree5308f9840e24f666dc2b7312763b20afbdfeb1a7 /src/utilcode
parent5b553b8149dd0d8ab87394d7974afaeff41a5f46 (diff)
downloadcoreclr-383736b96b643ba46ad290fc86601fc2d62a9436.tar.gz
coreclr-383736b96b643ba46ad290fc86601fc2d62a9436.tar.bz2
coreclr-383736b96b643ba46ad290fc86601fc2d62a9436.zip
Fix handling of incorrect assemblies on Unix (#16747)
* Return DPTR from PEDecoder::FindFirstSection() Change type of the function's return value to PTR_IMAGE_SECTION_HEADER instead of (IMAGE_SECTION_HEADER *) * Fix handling of incorrect assemblies on Unix This fixes the regression that was introduced by #10772 and is caused by a missing check for validity of loaded assembly file. Related issue: #15544
Diffstat (limited to 'src/utilcode')
-rw-r--r--src/utilcode/pedecoder.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utilcode/pedecoder.cpp b/src/utilcode/pedecoder.cpp
index ddd65d390d..e5e8ddce67 100644
--- a/src/utilcode/pedecoder.cpp
+++ b/src/utilcode/pedecoder.cpp
@@ -445,6 +445,7 @@ BOOL PEDecoder::HasWriteableSections() const
CONTRACT_CHECK
{
INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
PRECONDITION(CheckFormat());
NOTHROW;
GC_NOTRIGGER;
@@ -453,7 +454,7 @@ BOOL PEDecoder::HasWriteableSections() const
}
CONTRACT_CHECK_END;
- PTR_IMAGE_SECTION_HEADER pSection = FindFirstSection(FindNTHeaders());
+ PTR_IMAGE_SECTION_HEADER pSection = FindFirstSection();
_ASSERTE(pSection != NULL);
PTR_IMAGE_SECTION_HEADER pSectionEnd = pSection + VAL16(FindNTHeaders()->FileHeader.NumberOfSections);