diff options
Diffstat (limited to 'BaseTools/Source/C/Common')
-rw-r--r-- | BaseTools/Source/C/Common/BasePeCoff.c | 15 | ||||
-rw-r--r-- | BaseTools/Source/C/Common/CommonLib.h | 1 |
2 files changed, 9 insertions, 7 deletions
diff --git a/BaseTools/Source/C/Common/BasePeCoff.c b/BaseTools/Source/C/Common/BasePeCoff.c index 4a3f92fb15..54bd099e1d 100644 --- a/BaseTools/Source/C/Common/BasePeCoff.c +++ b/BaseTools/Source/C/Common/BasePeCoff.c @@ -979,6 +979,14 @@ Returns: ImageContext,
Section->VirtualAddress + Section->Misc.VirtualSize - 1
);
+ //
+ // If the base start or end address resolved to 0, then fail.
+ //
+ if ((Base == NULL) || (End == NULL)) {
+ ImageContext->ImageError = IMAGE_ERROR_SECTION_NOT_LOADED;
+ return RETURN_LOAD_ERROR;
+ }
+
if (ImageContext->IsTeImage) {
Base = (CHAR8 *) ((UINTN) Base + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);
End = (CHAR8 *) ((UINTN) End + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);
@@ -987,13 +995,6 @@ Returns: if (End > MaxEnd) {
MaxEnd = End;
}
- //
- // If the base start or end address resolved to 0, then fail.
- //
- if ((Base == NULL) || (End == NULL)) {
- ImageContext->ImageError = IMAGE_ERROR_SECTION_NOT_LOADED;
- return RETURN_LOAD_ERROR;
- }
//
// Read the section
diff --git a/BaseTools/Source/C/Common/CommonLib.h b/BaseTools/Source/C/Common/CommonLib.h index f407e6d1e9..0610b21ed0 100644 --- a/BaseTools/Source/C/Common/CommonLib.h +++ b/BaseTools/Source/C/Common/CommonLib.h @@ -23,6 +23,7 @@ Abstract: #define _EFI_COMMON_LIB_H
#include <Common/UefiBaseTypes.h>
+#include <Common/BuildVersion.h>
#define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination
//
// Function declarations
|