diff options
-rw-r--r-- | MdeModulePkg/Core/Dxe/Image/Image.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index 16fc91056a..8a3e869be6 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -389,7 +389,10 @@ GetPeCoffImageFixLoadingAssignedAddress( if (EFI_ERROR (Status)) {
return Status;
}
-
+ if (Size != sizeof (EFI_IMAGE_SECTION_HEADER)) {
+ return EFI_NOT_FOUND;
+ }
+
Status = EFI_NOT_FOUND;
if ((SectionHeader.Characteristics & EFI_IMAGE_SCN_CNT_CODE) == 0) {
@@ -1128,11 +1131,9 @@ CoreLoadImageCommon ( }
}
- if (Status == EFI_ALREADY_STARTED) {
+ if (EFI_ERROR (Status)) {
Image = NULL;
goto Done;
- } else if (EFI_ERROR (Status)) {
- return Status;
}
if (gSecurity2 != NULL) {
@@ -1194,7 +1195,8 @@ CoreLoadImageCommon ( //
Image = AllocateZeroPool (sizeof(LOADED_IMAGE_PRIVATE_DATA));
if (Image == NULL) {
- return EFI_OUT_OF_RESOURCES;
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
}
//
|