summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C/Common/BasePeCoff.c
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-18 12:17:25 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-18 12:17:25 +0000
commitb36d134faf4305247830522b8e2bb255e98c5699 (patch)
treeec37795cbc86b693528a062030cb516039bcb1c2 /BaseTools/Source/C/Common/BasePeCoff.c
parente7fe4028631b6a7d70e3c02c7c40ff1504321daa (diff)
downloadedk2-b36d134faf4305247830522b8e2bb255e98c5699.zip
edk2-b36d134faf4305247830522b8e2bb255e98c5699.tar.gz
edk2-b36d134faf4305247830522b8e2bb255e98c5699.tar.bz2
Sync BaseTools Branch (version r2321) to EDKII main trunk.
Signed-off-by: lgao4 Reviewed-by: gikidy git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12372 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/C/Common/BasePeCoff.c')
-rw-r--r--BaseTools/Source/C/Common/BasePeCoff.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/BaseTools/Source/C/Common/BasePeCoff.c b/BaseTools/Source/C/Common/BasePeCoff.c
index 4a3f92f..54bd099 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