summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BasePeCoffLib
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/BasePeCoffLib')
-rw-r--r--MdePkg/Library/BasePeCoffLib/BasePeCoff.c9
1 files changed, 4 insertions, 5 deletions
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;
}
}