From 497ef745f0719f3dffc5f4be45aa3652a52f2316 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Tue, 16 Jan 2007 06:30:16 +0000 Subject: [PATCH] Fix PeLoad function can't handle invalid PeImage to skip correct debug entry. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2253 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 4 ++-- Tools/CCode/Source/PeCoffLoader/BasePeCoff.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c index cce9a82520..d82107ecde 100644 --- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c +++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c @@ -391,7 +391,7 @@ PeCoffLoaderGetImageInfo ( } if (DebugDirectoryEntryFileOffset != 0) { - for (Index = 0; Index < DebugDirectoryEntry->Size; Index += Size) { + for (Index = 0; Index < DebugDirectoryEntry->Size; Index += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) { // // Read next debug directory entry // @@ -479,7 +479,7 @@ PeCoffLoaderGetImageInfo ( } if (DebugDirectoryEntryFileOffset != 0) { - for (Index = 0; Index < DebugDirectoryEntry->Size; Index += Size) { + for (Index = 0; Index < DebugDirectoryEntry->Size; Index += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) { // // Read next debug directory entry // diff --git a/Tools/CCode/Source/PeCoffLoader/BasePeCoff.c b/Tools/CCode/Source/PeCoffLoader/BasePeCoff.c index 72df90f389..06d4b83af7 100644 --- a/Tools/CCode/Source/PeCoffLoader/BasePeCoff.c +++ b/Tools/CCode/Source/PeCoffLoader/BasePeCoff.c @@ -346,7 +346,7 @@ Returns: } if (DebugDirectoryEntryFileOffset != 0) { - for (Index = 0; Index < (DebugDirectoryEntry->Size); Index += Size) { + for (Index = 0; Index < DebugDirectoryEntry->Size; Index += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) { // // Read next debug directory entry // @@ -438,7 +438,7 @@ Returns: } if (DebugDirectoryEntryFileOffset != 0) { - for (Index = 0; Index < (DebugDirectoryEntry->Size); Index += Size) { + for (Index = 0; Index < DebugDirectoryEntry->Size; Index += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) { // // Read next debug directory entry //