From f92b6f195ca1977fde10deb5c33ac2fd11dbd2a1 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Fri, 12 Jan 2007 04:54:20 +0000 Subject: Correctly skip debug entry. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2232 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'MdePkg/Library/BasePeCoffLib') diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c index 0ddbc7a672..ad9c627727 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++) { + for (Index = 0; Index < DebugDirectoryEntry->Size; Index += Size) { // // Read next debug directory entry // @@ -406,9 +406,8 @@ PeCoffLoaderGetImageInfo ( ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ; return Status; } - if (DebugEntry.Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) { - ImageContext->DebugDirectoryEntryRva = (UINT32) (DebugDirectoryEntryRva + Index * sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)); + ImageContext->DebugDirectoryEntryRva = (UINT32) (DebugDirectoryEntryRva + Index); if (DebugEntry.RVA == 0 && DebugEntry.FileOffset != 0) { ImageContext->ImageSize += DebugEntry.SizeOfData; } @@ -480,7 +479,7 @@ PeCoffLoaderGetImageInfo ( } if (DebugDirectoryEntryFileOffset != 0) { - for (Index = 0; Index < DebugDirectoryEntry->Size; Index++) { + for (Index = 0; Index < DebugDirectoryEntry->Size; Index += Size) { // // Read next debug directory entry // @@ -497,7 +496,7 @@ PeCoffLoaderGetImageInfo ( } if (DebugEntry.Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) { - ImageContext->DebugDirectoryEntryRva = (UINT32) (DebugDirectoryEntryRva + Index * sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)); + ImageContext->DebugDirectoryEntryRva = (UINT32) (DebugDirectoryEntryRva + Index); return RETURN_SUCCESS; } } -- cgit v1.2.3