diff options
Diffstat (limited to 'MdePkg/Library/BasePeCoffLib/BasePeCoff.c')
-rw-r--r-- | MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c index 617e86dfda..fab7ab3b4c 100644 --- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c +++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c @@ -68,7 +68,7 @@ PeCoffLoaderGetPeHeader ( UINTN Size;
UINTN ReadSize;
UINT32 SectionHeaderOffset;
- UINT32 Index;
+ UINTN Index;
UINT32 HeaderWithoutDataDir;
CHAR8 BufferData;
UINTN NumberOfSections;
@@ -1407,7 +1407,7 @@ PeCoffLoaderLoadImage ( return RETURN_LOAD_ERROR;
}
- if (Section->SizeOfRawData > 0) {
+ if ((Section->SizeOfRawData > 0) && (Base != NULL)) {
Status = ImageContext->ImageRead (
ImageContext->Handle,
Section->PointerToRawData - TeStrippedOffset,
@@ -1424,7 +1424,7 @@ PeCoffLoaderLoadImage ( // If raw size is less then virtual size, zero fill the remaining
//
- if (Size < Section->Misc.VirtualSize) {
+ if ((Size < Section->Misc.VirtualSize) && (Base != NULL)) {
ZeroMem (Base + Size, Section->Misc.VirtualSize - Size);
}
|